【发布时间】:2018-01-13 04:59:19
【问题描述】:
我开始使用 Angular,更具体地说是 v5,但我遇到了一些问题。
我的一个要求是有一种方法可以从 HTML 页面配置和手动引导应用程序。我进行了一些研究,发现 Angular v1.x 有办法做到这一点。示例:
配置:
var config = { //my configuration object }
myApp.config(['myConfigProvider', 'myBaseFeaturesProvider', function(myConfigProvider, myBaseFeaturesProvider) {
//make the necessary configuration with the config object
}]);
然后运行应用程序,将其插入页面上的特定位置:
myApp.run(['$templateCache', function($templateCache) {
angular.element('#myId').html($templateCache.get('path/to/app/html/app.html'));
}]);
我的问题是如何在 Angular 5 中做到这一点?目前我使用 angular-cli 设置应用程序,但我没有找到任何具体到我提到的点。
【问题讨论】:
标签: angular-cli angular5