I have a ng-controller in _Layout page like this.
<div ng-controller="LayoutController">
left content....
@RenderBody
right content..
And using angular module in layout with ajax ( that part works )
<script type="text/javascript">
var module_ = angular.module("myapp", []);
var controller_ = module_.controller("layoutController", function ($scope) {
$.ajax({
type: "POST",
url: "Home/GetMenu",
success: function (result) {
$.each(result, function (i, ix) {
result[i].ID = i + 1;
});
$scope.TopCharactersModel = result;
$scope.$apply();
},
complete: function () {
}
})
Then i want to use another Ng-Controller inside Index.html which derived from this layout page. Javascript code is not work at this side and chrome debugger show this error WARNING: Tried to load angular more than once.
<div ng-controller="IndexController">
<div class="panel-group" id="accordion" ng-repeat="arr_ in newsArr">
</div>
</div>
<script>
var module = angular.module("myapp", []);
var myController1 = module_.controller("IndexController", function ($scope) {
$.ajax({
url: "Home/GetNews",
type: "POST",
success: function (result) {
$scope.newsArr = result;
// $scope.$digest();
$scope.$apply()
},
complete: function () {
}
});
});
</script>