小编jgp*_*s2w的帖子

angular + firebase auth + material =路由器崩溃

在firebase身份验证后路由器无法正常工作.问题是来自@ angular/animations,导入NoopAnimationsModule或BrowserAnimationsModule,路由器无法正常工作

的package.json

"dependencies": { "@angular/animations": "^5.2.8", "@angular/cdk": "^5.2.4", "@angular/common": "^5.2.0", "@angular/compiler": "^5.2.0", "@angular/core": "^5.2.0", "@angular/forms": "^5.2.0", "@angular/http": "^5.2.0", "@angular/material": "^5.2.4", "@angular/platform-browser": "^5.2.0", "@angular/platform-browser-dynamic": "^5.2.0", "@angular/router": "^5.2.0", "angularfire2": "^5.0.0-rc.6", "core-js": "^2.4.1", "firebase": "^4.11.0", "rxjs": "^5.5.6", "zone.js": "^0.8.19" }

我通过Google验证后重定向到路由'/ protected',但页面显示新的路由组件和前一个组件: 截图

问题必须是Angularfire和Material Animations之间的兼容性问题:评论BrowserAnimationsModule的导入修复了这个问题.

为了帮助理解和重现,你有:
- StackBlitz项目令人讨厌的部分是这个例子有效,但仍然呈现一个过渡状态,其中显示了两个组件.
- github存储库,其中最少的代码重现错误.
- 从前一个回购运行应用程序.

一旦找到修复程序,firebase凭据将停止工作,因此请使用您自己的.

提前致谢.

material firebase firebase-authentication angular

2
推荐指数
1
解决办法
320
查看次数

在没有ionic-native的情况下将cordova插件用于ionicframework

我找到了一个为codova制作的插件:
https : //github.com/dff-solutions/dff-cordova-plugin-honeywell
该文档描述了如何直接使用对象Honeywell,但没有介绍如何导入到app.module中。并做出适当的调整。我还没有发现关于离子本地开发或清晰的文档科尔多瓦插件移植到离子2.
请任何指导线如何得到任何科尔多瓦插件融入现代离子2
更新:在我的情况下,有一些解决方法,因为我有一个由插件创建的全局变量,所以我在@Component装饰器之前声明该变量。但这招破坏了依赖注入系统。

import { Component, NgZone } from '@angular/core';
import { NavController } from 'ionic-angular';

declare var Honeywell;//declare the global created by the plugin

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {
  barcode: string;
  constructor(public navCtrl: NavController, public zone: NgZone) {
        Honeywell
          .onBarcodeEvent( ... );
  }

}
Run Code Online (Sandbox Code Playgroud)

ionic-framework cordova-plugins ionic2

0
推荐指数
1
解决办法
1309
查看次数