我在一个页面中有2个ng-app。 fst ng-app运行正常,但是无论将控制器分配给第二个ng-app,该控制器均无法运行。出现“'TemplateOnLoadController'不是函数,未定义”错误
请尝试以下代码,请查看下面的代码
<div ng-app="appMain" id="App1">
<section id="nx-tool-box" class="w-100 h-100" ng-controller="MainController">
<section id="nx-tool-wrap" class="h-100 d-flex flex-column flex-md-row flex-nowrap" ng-if="isAppInit" ng-include="'views/view.html'">
</section>
</section>
</div>
<div id="isTemplate">
<div ng-app="templateOnLoadApp" id="App2">
<div ng-controller="TemplateOnLoadController">
<form>
First Name: <input type="text" ng-model="firstname">
</form>
</div>
</div>
var DesignAppRoot = angular.module('templateOnLoadApp', []);
var appElementB = document.getElementById('App2');
angular.bootstrap(appElementB, ['templateOnLoadApp']);