我试图在Ionic中完全禁用Angular的$ sce服务,但是我不知道在哪里放置代码。
这是我需要插入的片段:
angular.module('myAppWithSceDisabledmyApp', []).config(function($sceProvider) {
// Completely disable SCE. For demonstration purposes only!
// Do not use in new projects.
$sceProvider.enabled(false); });
我稍后会转到白名单 - 但我需要知道将此代码放在何处。我把它放在main.ts,page.ts,app.module.ts中,每次我收到以下错误:
Cannot find name 'angular'.
你能否指出我应该放置此代码的方向,或者我做错了什么?
编辑:这是app.module.ts的完整代码:
import { NgModule, ErrorHandler } from '@angular/core';
import { IonicApp, IonicModule, IonicErrorHandler, Platform, App } from 'ionic-angular';
import { MyApp } from './app.component';
import { Page1 } from '../pages/page1/page1';
import { Page2 } from '../pages/page2/page2';
import { TutorialPage } from '../pages/tutorial/tutorial';
import { Users } from '../providers/users';
@NgModule({
declarations: [
MyApp,
Page1,
Page2,
TutorialPage
],
imports: [
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
Page1,
Page2,
TutorialPage
],
providers: [{provide: ErrorHandler, useClass: IonicErrorHandler}, [Users]]
})
export class AppModule {}
angular.module('MyApp', []).config(function($sceProvider) {
// Completely disable SCE. For demonstration purposes only!
// Do not use in new projects.
$sceProvider.enabled(false);
});