pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

    1. <legend id='1NmM4'><style id='1NmM4'><dir id='1NmM4'><q id='1NmM4'></q></dir></style></legend>
        <bdo id='1NmM4'></bdo><ul id='1NmM4'></ul>

    2. <small id='1NmM4'></small><noframes id='1NmM4'>

      <i id='1NmM4'><tr id='1NmM4'><dt id='1NmM4'><q id='1NmM4'><span id='1NmM4'><b id='1NmM4'><form id='1NmM4'><ins id='1NmM4'></ins><ul id='1NmM4'></ul><sub id='1NmM4'></sub></form><legend id='1NmM4'></legend><bdo id='1NmM4'><pre id='1NmM4'><center id='1NmM4'></center></pre></bdo></b><th id='1NmM4'></th></span></q></dt></tr></i><div class="hlzfvbn" id='1NmM4'><tfoot id='1NmM4'></tfoot><dl id='1NmM4'><fieldset id='1NmM4'></fieldset></dl></div>
      <tfoot id='1NmM4'></tfoot>

      1. 如何更新 ionic 2 側菜單中的值

        How to update value inside ionic 2 side menu(如何更新 ionic 2 側菜單中的值)
            <legend id='gmLHG'><style id='gmLHG'><dir id='gmLHG'><q id='gmLHG'></q></dir></style></legend>
              <tbody id='gmLHG'></tbody>

              <bdo id='gmLHG'></bdo><ul id='gmLHG'></ul>
            • <tfoot id='gmLHG'></tfoot>
              <i id='gmLHG'><tr id='gmLHG'><dt id='gmLHG'><q id='gmLHG'><span id='gmLHG'><b id='gmLHG'><form id='gmLHG'><ins id='gmLHG'></ins><ul id='gmLHG'></ul><sub id='gmLHG'></sub></form><legend id='gmLHG'></legend><bdo id='gmLHG'><pre id='gmLHG'><center id='gmLHG'></center></pre></bdo></b><th id='gmLHG'></th></span></q></dt></tr></i><div class="bhnjrr7" id='gmLHG'><tfoot id='gmLHG'></tfoot><dl id='gmLHG'><fieldset id='gmLHG'></fieldset></dl></div>

              • <small id='gmLHG'></small><noframes id='gmLHG'>

                • 本文介紹了如何更新 ionic 2 側菜單中的值的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  如何將日期從頁面轉移"到 Ionic2 中的 side-menu,即 -具有 app.page.html 如下:

                  How to "transfer" date from page into side-menu in Ionic2, i.e - Having app.page.html like following:

                  <ion-menu [content]="content">
                  
                      <ion-content class="menu-left">
                          <!-- User profile -->
                          <div text-center padding-top padding-bottom class="primary-bg menu-left">
                              <a menuClose>
                                  <h4 light>{{userName}}</h4>
                              </a>
                          </div>
                  
                          <ion-list class="list-full-border">
                              <button ion-item menuClose *ngFor="let page of pages" (click)="openPage(page)">
                          <ion-icon item-left name="{{ page.icon }}"></ion-icon>
                          {{ page.title }}
                          <ion-badge color="danger" item-right *ngIf="page.count">{{ page.count }}</ion-badge>
                        </button>
                          </ion-list>
                      </ion-content>
                  
                  </ion-menu>
                  
                  <ion-nav [root]="rootPage" #content swipeBackEnabled="false"></ion-nav>
                  

                  如何根據從 facebookLogin.page 獲取的數據在頁面中的操作上更新 userName 值?

                  how to update userName value upon the action in the page upon the data gotten from facebookLogin.page ?

                  facebookLogin.page.ts:

                  ...
                  fbLogin() {
                      Facebook.login(["public_profile", "email"])
                        .then((resp: FacebookLoginResponse) => {
                  
                          if (resp.status === "connected") {
                            Facebook.api("/me", ["public_profile", "email"])
                              .then(res => {
                               this.userName = res.name
                                this.login({name: this.userName})
                              })
                          ...
                        );
                    }
                  
                   login(params) {
                      this.nav.setRoot(HomePage, params);
                    }
                  ...
                  

                  (那么,我如何將使用 facebook 登錄后獲得的 userName 導入 app.html 中的 ion-sideMenu 中;如何我可以讓 EventEmmiterservice/observe 來觀察 app.html 的 ion-menu 的變化……其他方式?)

                  (so, how would I import the userName which I get after login with facebook into ion-sideMenu in app.html; how I could make EventEmmiter, service/observe for changes in app.html's ion-menu ... some other way?)

                  推薦答案

                  ionic2 - 使用事件

                  查看活動文檔

                  它們允許您從任何頁面發布"操作,并在另一個頁面中訂閱它以檢索值.你的場景看起來有點像這樣.

                  They allow you to 'publish' an action from any page, and subscribe to it in another page to retrieve the value. Your scenario would look a bit like this.

                  導入(在 Facebooklogin.componentapp.component 上)

                  Import (both on Facebooklogin.component and app.component)

                  import { Events } from 'ionic-angular'; 和你的構造函數 constructor(public events: Events)

                  然后,每當您更改 userName(例如在 facebook 登錄的處理程序中)時,都會像這樣發布值.

                  Then, whenever you change your userName (f.e. in the handler of the facebook login) publish the value like this.

                  fbLogin() {
                      Facebook.login(["public_profile", "email"])
                        .then((resp: FacebookLoginResponse) => {
                  
                          if (resp.status === "connected") {
                            Facebook.api("/me", ["public_profile", "email"])
                              .then(res => {
                               this.userName = res.name
                               // publish the username change to the events
                               this.events.publish('username:changed', this.userName);
                                this.login({name: this.userName})
                              })
                          //...
                        );
                    }
                  

                  并訂閱在您的 app.component 中進行的任何發布

                  And subscribe to any publishes being made in your app.component

                  userName: string;
                  
                  constructor(events: Events) {
                     this.userName = "not logged in";
                  
                     events.subscribe('username:changed', username => {
                        if(username !== undefined && username !== ""){
                          this.userName = username;
                        }
                     }) //... 
                  }
                  

                  <小時>

                  angular2 - 使用 EventEmitter


                  angular2 - using EventEmitter

                  import { EventEmitter } from '@angular/core';
                  
                  public userChanged = new EventEmitter();
                  
                  fbLogin() {
                          Facebook.login(["public_profile", "email"])
                            .then((resp: FacebookLoginResponse) => {
                  
                              if (resp.status === "connected") {
                                Facebook.api("/me", ["public_profile", "email"])
                                  .then(res => {
                                   this.userName = res.name
                                   // publish the username change to the events
                                   this.userChanged.emit(this.userName);
                                   this.login({name: this.userName})
                                  })
                              ...
                            );
                        }
                  

                  App.component

                  App.component

                  import { FacebookLogin } from '../pages/facebook/facebook.component';
                  
                  public userName;
                  
                  constructor(fb: FacebookLogin){
                  
                      this.userName = "";
                      //subscribe to the page's EventEmitter
                      this.fb.userChanged.subscribe(username => {
                         this.userName = username;
                      });
                  }
                  

                  或使用 EventEmitter 作為 Output,如本 S.O. 中所述.回答:EventEmitter 的正確用法是什么?

                  OR use the EventEmitter as an Output as described in this S.O. answer: What is the proper use of an EventEmitter?

                  這篇關于如何更新 ionic 2 側菜單中的值的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Use IScroll in Angular 2 / Typescript(在 Angular 2/Typescript 中使用 IScroll)
                  anime.js not working in Ionic 3 project(Anime.js 在 Ionic 3 項目中不起作用)
                  Ionic 3 - Update Observable with Asynchronous Data(Ionic 3 - 使用異步數據更新 Observable)
                  Angular 2: file not found on local .json file(Angular 2:在本地 .json 文件中找不到文件)
                  In Ionic 2, how do I create a custom directive that uses Ionic components?(在 Ionic 2 中,如何創建使用 Ionic 組件的自定義指令?)
                  Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(將 ViewChild 用于動態元素 - Angular 2 amp;離子2)

                      <i id='W7gRt'><tr id='W7gRt'><dt id='W7gRt'><q id='W7gRt'><span id='W7gRt'><b id='W7gRt'><form id='W7gRt'><ins id='W7gRt'></ins><ul id='W7gRt'></ul><sub id='W7gRt'></sub></form><legend id='W7gRt'></legend><bdo id='W7gRt'><pre id='W7gRt'><center id='W7gRt'></center></pre></bdo></b><th id='W7gRt'></th></span></q></dt></tr></i><div class="dhh7zp5" id='W7gRt'><tfoot id='W7gRt'></tfoot><dl id='W7gRt'><fieldset id='W7gRt'></fieldset></dl></div>
                      • <bdo id='W7gRt'></bdo><ul id='W7gRt'></ul>
                        • <small id='W7gRt'></small><noframes id='W7gRt'>

                        • <tfoot id='W7gRt'></tfoot>

                            <tbody id='W7gRt'></tbody>
                        • <legend id='W7gRt'><style id='W7gRt'><dir id='W7gRt'><q id='W7gRt'></q></dir></style></legend>

                            主站蜘蛛池模板: 苏州伊诺尔拆除公司_专业酒店厂房拆除_商场学校拆除_办公楼房屋拆除_家工装拆除拆旧 | 结晶点测定仪-润滑脂滴点测定仪-大连煜烁 | 化妆品加工厂-化妆品加工-化妆品代加工-面膜加工-广东欧泉生化科技有限公司 | 专业深孔加工_东莞深孔钻加工_东莞深孔钻_东莞深孔加工_模具深孔钻加工厂-东莞市超耀实业有限公司 | 焊锡丝|焊锡条|无铅锡条|无铅锡丝|无铅焊锡线|低温锡膏-深圳市川崎锡业科技有限公司 | 电子厂招聘_工厂招聘_普工招聘_小时工招聘信息平台-众立方招工网 | 浙江美尔凯特智能厨卫股份有限公司| 泰来华顿液氮罐,美国MVE液氮罐,自增压液氮罐,定制液氮生物容器,进口杜瓦瓶-上海京灿精密机械有限公司 | 闸阀_截止阀_止回阀「生产厂家」-上海卡比阀门有限公司 | 宁波普瑞思邻苯二甲酸盐检测仪,ROHS2.0检测设备,ROHS2.0测试仪厂家 | 凝胶成像系统(wb成像系统)百科-上海嘉鹏 | DWS物流设备_扫码称重量方一体机_快递包裹分拣机_广东高臻智能装备有限公司 | 捆扎机_气动捆扎机_钢带捆扎机-沈阳海鹞气动钢带捆扎机公司 | 【直乐】河北石家庄脊柱侧弯医院_治疗椎间盘突出哪家医院好_骨科脊柱外科专业医院_治疗抽动症/关节病骨伤权威医院|排行-直乐矫形中医医院 | 丝杆升降机-不锈钢丝杆升降机-非标定制丝杆升降机厂家-山东鑫光减速机有限公司 | 横河变送器-横河压力变送器-EJA变送器-EJA压力变送器-「泉蕴仪表」 | 湖南长沙商标注册专利申请,长沙公司注册代理记账首选美创! | 淘气堡_室内儿童乐园_户外无动力儿童游乐设备-高乐迪(北京) | 播音主持培训-中影人教育播音主持学苑「官网」-中国艺考界的贵族学校 | 吨袋包装机|吨包秤|吨包机|集装袋包装机-烟台华恩科技 | 自动气象站_农业气象站_超声波气象站_防爆气象站-山东万象环境科技有限公司 | sfp光模块,高速万兆光模块工厂-性价比更高的光纤模块制造商-武汉恒泰通 | 电动不锈钢套筒阀-球面偏置气动钟阀-三通换向阀止回阀-永嘉鸿宇阀门有限公司 | 真空乳化机-灌装封尾机-首页-温州精灌| 长沙广告公司|长沙广告制作设计|长沙led灯箱招牌制作找望城湖南锦蓝广告装饰工程有限公司 | 理化生实验室设备,吊装实验室设备,顶装实验室设备,实验室成套设备厂家,校园功能室设备,智慧书法教室方案 - 东莞市惠森教学设备有限公司 | 自动气象站_农业气象站_超声波气象站_防爆气象站-山东万象环境科技有限公司 | 展厅设计公司,展厅公司,展厅设计,展厅施工,展厅装修,企业展厅,展馆设计公司-深圳广州展厅设计公司 | 济南品牌包装设计公司_济南VI标志设计公司_山东锐尚文化传播 | 智能垃圾箱|垃圾房|垃圾分类亭|垃圾分类箱专业生产厂家定做-宿迁市传宇环保设备有限公司 | 常州翔天实验仪器厂-恒温振荡器-台式恒温振荡器-微量血液离心机 恒温恒湿箱(药品/保健品/食品/半导体/细菌)-兰贝石(北京)科技有限公司 | DWS物流设备_扫码称重量方一体机_快递包裹分拣机_广东高臻智能装备有限公司 | 温泉机设备|温泉小镇规划设计|碳酸泉设备 - 大连连邦温泉科技 | 「阿尔法设计官网」工业设计_产品设计_产品外观设计 深圳工业设计公司 | 脉冲除尘器,除尘器厂家-淄博机械| 深圳善跑体育产业集团有限公司_塑胶跑道_人造草坪_运动木地板 | 沈阳楼承板_彩钢板_压型钢板厂家-辽宁中盛绿建钢品股份有限公司 轴承振动测量仪电箱-轴承测振动仪器-测试仪厂家-杭州居易电气 | 贵州自考_贵州自学考试网| 新能源汽车电机定转子合装机 - 电机维修设备 - 睿望达 | 冷却塔降噪隔音_冷却塔噪声治理_冷却塔噪音处理厂家-广东康明冷却塔降噪厂家 | 仿清水混凝土_清水混凝土装修_施工_修饰_保护剂_修补_清水混凝土修复-德州忠岭建筑装饰工程 |