Safe value must use [property]=binding after bypass security with DomSanitizer

As the error message says, the sanitized HTML needs to be added using property binding: <p [innerHTML]=”massTimingsHtml”></p> constructor(private domSanitizer:DomSanitizer) { this.massTimingsHtml = this.getInnerHTMLValue(); } getInnerHTMLValue(){ return this.domSanitizer.bypassSecurityTrustHtml(this.parishDetail.mass_timings); } StackBlitz example (based on Swapnil Patwa’s Plunker – see comments below)

access SASS values ($colors from variables.scss) in Typescript (Angular2 ionic2)

Unfortunately, there is no way to access SASS variable directly from typescript/javascript code. However, we can make a workaround to access those variables. Let me describe briefly the steps to access SASS variables from within typescript source code: 1. Creating a SASS Helper Component Create ../providers/sass-helper/sass-helper.component.scss: $prefix: “–“; //Prefix string for custom CSS properties //Merges … Read more

Iterate a Json Object with ngFor

You can get the keys from an object using Object.keys (requires polyfill in IE AFAIK) import { Pipe, PipeTransform } from ‘@angular/core’; @Pipe({ name: ‘keys’ }) export class KeysPipe implements PipeTransform { transform(value): any { if(!value) return null; return Object.keys(value); } } <div *ngFor=”let key of member | keys”>{{member[key]}}</div> For Angular 6 see How to … Read more

How to handle back button on Ionic 2

Here’s how I did it: In every Page component, I created a function called backButtonAction(), which will execute custom code for every page. Code: import { Component } from ‘@angular/core’; import { Platform, NavController, ModalController } from ‘ionic-angular’; import { DetailsModal } from ‘./details’; @Component({ selector: ‘page-appointments’, templateUrl: ‘appointments.html’ }) export class AppointmentsPage { modal: … Read more

Page is part of the declarations of 2 modules: Error in ionic build prod

This is a basic error of angular. You can see the issue here. So the answer that is accepted till now is use share module. You can do like this: – Create a share.module.ts – Import, declaration and export your component in this share.module.ts import { NgModule } from ‘@angular/core’; import {SharedComponentA} from “./SharedComponentA”; import … Read more