/**
 *   新建页面demo样本
 *  - demo页面会引入democomponent教程
 *  - demo页面会引入demoprovider教程
 *  - demo页面会引入demopipe教程
 *  - demo页面会引入第三方js教程，如jquery
 */ import { Component , Input } from '@angular/core' ; import { IonicPage , NavController , NavParams } from 'ionic-angular' ; import { InterfaceListProvider } from '../../providers/interface-list/interface-list' ; import { GeolocationProvider } from '../../providers/geolocation/geolocation' ; Input Output /**
 *  引入第三方js教程，如jquery
 *  1. 先在入口index.html文件引入js
 *      <script src="assets/js/jquery-1.7.2.js"></script>
 *  2. 在使用的页面申明
 *      declare var $: any;
 *  3. 直接使用
 */ declare var $ ; @ IonicPage ( ) @ Component ( { selector : 'page-page-demo' , templateUrl : 'page-demo.html' , } ) export class PageDemoPage { name : string = 'wang' ; sonToFaterData : string ; httpReturnData : string ; constructor ( public navCtrl , public interface_lists , public geolocation , public navParams ) { } ionViewDidLoad ( ) { this . jqueryDemo ( ) ; } httpTest ( ) { this . interface_lists . httpTset ( ) . then ( ( returnData ) => { console . log ( returnData ) ; this . httpReturnData = JSON . stringify ( returnData ) ; } ) ; } getGeolocation ( ) { this . geolocation . watchPosition ( ) ; } getTpMap ( ) { this . navCtrl . push ( 'GaodemapPage' ) ; } jqueryDemo ( ) { $ ( '.jqueryClass1' ) . on ( 'click' , ( ) => { $ ( this ) . html ( 'jquery button click' ) ; $ ( this ) . css ( 'color' , 'red' ) ; console . log ( 'click' ) ; } ) ; $ ( '.jqueryClass2' ) . on ( 'click' , function ( ) { $ ( this ) . html ( 'jquery button click' ) ; $ ( this ) . css ( 'color' , 'red' ) ; console . log ( 'click' ) ; } ) ; } toSonData ( ) { this . name = '你好 世界' ; } sonToFaterEventCallback ( e ) { console . log ( e . sonToFaterData ) ; this . sonToFaterData = e . sonToFaterData ; } openBrower ( ) { this . navCtrl . push ( 'BrowserPage' , { browser : { title : '页面名称' , url : 'https://www.baidu.com' } } ) ; } }