首页 > 解决方案 > 在 app.module.js 中的 Ionic 3 中导入 Angular 指令

问题描述

我正在尝试添加一个npm 包 ,该包会自动滚动到 ionic 3 中元素的底部。导入后我一直收到错误消息:

错误

scrollglue.js:164 Uncaught ReferenceError: 角度未定义

app.module.js

    import { NgModule, ErrorHandler } from '@angular/core';
    import { BrowserModule } from '@angular/platform-browser';
    import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
    import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
    import { HttpClientModule } from '@angular/common/http';
    import { MyApp } from './app.component';
    //trying to import this angular directive 
    import { GlueScroll } from 'angularjs-scroll-glue';


    ....

  declarations: [
    MyApp,
    PaymentPage,
    PaypalPage,
    AboutPage,
    GlueScroll
  ],
  imports: [
    BrowserModule,
    HttpClientModule,
    BrowserAnimationsModule,
    IonicModule.forRoot(MyApp,  {
        tabsHideOnSubPages: true,
    }),
    NgCircleProgressModule.forRoot({
        showTitle: false,
        showSubtitle: false,
        showUnits: false,
        space: -6,
        backgroundPadding: -4,
        backgroundStrokeWidth : -3
    }),
    PipesModule
  ],

普朗克

http://plnkr.co/edit/wxTyp7PpyxJOHSlUumVC?p=preview

标签: angularionic-frameworkionic2

解决方案


推荐阅读