如何为特定组件加载angular-social-auth模块

时间:2018-03-15 07:32:39

标签: angular npm login social

我正在使用angular2-social-auth模块进行Facebook和谷歌登录以及主app模块中的模块,一切正常。但问题是angular-social-auth模块影响其他组件(仪表板组件,配置文件组件等)加载问题。(注意:所有组件都有一个主应用程序模块)我的问题是,< strong>有没有办法限制登录组件的angular-social-auth模块。

主要应用模块

    import { NgModule }from '@angular/core';
    import { AppComponent } from './app.component';
    import { BrowserModule } from '@angular/platform-browser';
    import { Angular2SocialLoginModule } from "angular2-social-login";
    import { DashboardComponent } from components/dashboard/dashboard.component';
    import { ProfileComponent } from './components/profile/profile.component';


    let providers = {
        "google": {
          "clientId": "GOOGLE_CLIENT_ID"
        },
        "facebook": {
          "clientId": "FACEBOOK_CLIENT_ID",
          "apiVersion": "<version>" //like v2.4 
        }
      };

    @NgModule({
     declarations: [
      DashboardComponent,
      ProfileComponent
    ],
      imports: [ 
                  BrowserModule,
                  Angular2SocialLoginModule
              ],
      declarations: [AppComponent],
      bootstrap: [ AppComponent ]
    })

   export class AppModule { 
      constructor(){}
    }

    Angular2SocialLoginModule.loadProvidersScripts(providers);

0 个答案:

没有答案