Angular起始设置 config,run
作者:
李霖弢 | 来源:发表于
2017-08-07 14:23 被阅读71次ng启动顺序
- config阶段是给了ng上下文一个针对constant与provider修改其内部属性的一个阶段
- run阶段是在config之后的在运行独立的代码块,通常写法runBlock
- 简单的说一下就是ng启动阶段是 config-->run-->compile/link
app.config(['$compileProvider', '$httpProvider', '$locationProvider',
function ($compileProvider, $httpProvider, $locationProvider) {
$compileProvider.debugInfoEnabled(true);//是否开启调试器
$compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|weixin|wxlocalresource|data):/);//白名单
$httpProvider.interceptors.push('authInterceptor');//http拦截器,为请求添加全局功能
$locationProvider.html5Mode(false).hashPrefix('!');//配置$location
}
])
本文标题:Angular起始设置 config,run
本文链接:https://www.haomeiwen.com/subject/dgtalxtx.html
网友评论