Skip to main content

Posts

Showing posts from March, 2017

Working tutorials on ionic push notification.

Working tutorials on ionic push notification. https://github.com/replysam2009/ionic2-push-notifications ionic start -- v2 myApp blank npm install @ ionic / cloud - angular -- save ionic plugin add phonegap-plugin-push --variable SENDER_ID=XXXXXXXXX How to get SENDER_ID: https://medium.com/@ankushaggarwal/gcm-setup-for-android-push-notifications-656cfdd8adbd#.2dfwmb64z Go to : https://apps.ionic.io/ Create account give command :  ionic upload See app in account here  :   https://apps.ionic.io/ Upload app Copy app id  in app.module.ts import { NgModule, ErrorHandler } from '@angular/core'; import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular'; import { MyApp } from './app.component'; import { AboutPage } from '../pages/about/about'; import { ContactPage } from '../pages/contact/contact'; import { HomePage } from '../pages/home/hom

Observable after every send return example

Observable after every send return example setData(data: any): Observable<Array<any>> { this.amount = data.amount; this.currency = data.currency; this.description = data.description; this.email = data.email; this.source = data.source; this.customer = data.customer; return Observable.interval(1000).map(i=> [{amount: this.amount},{currency: this.currency},{email:this.email}]); }

How to create directive in angular 2 -- Limit the length of a string using angular 2/ionic 2

How to create directive in angular 2 -- Limit the length of a string using angular 2/ionic 2 In angular2 it will look like: import {Directive, Input} from '@angular/core'; @Directive({   selector: '[limit-to]',   host: {     '(keypress)': '_onKeypress($event)',   } }) export class LimitToDirective {   @Input('limit-to') limitTo;    _onKeypress(e) {      const limit = +this.limitTo;      if (e.target.value.length === limit) e.preventDefault();   } } Don't forget to register directive in NgModule sth like: @NgModule({   imports: [ BrowserModule ],   declarations: [ App, LimitToDirective ],  //keep this in declaration only   bootstrap: [ App ] }) export class AppModule {} And then use it like: <input limit-to="4" type="number" placeholder="enter first 4 digits: 09XX"> https://plnkr.co/edit/sgMubU0p8Z5BPzAIKsf4?p=preview Conf