0
我想包括一個模板邊欄,它不工作。它只是顯示包含應該的空白點。包括我每次嘗試使用它們時都遇到過麻煩。有什麼我做錯了嗎?Ang ng包括不工作
這裏是我的代碼:
<html ng-app="smartyet">
包括:
<div ng-include="'/assets/includes/controls.html'" ng-app="smartyet"></div>
應用:
var smartyet = angular.module('smartyet', ['ngAnimate']).config([function() {
}])
smartyet.controller('ControlsCtrl', ['$scope', function($scope) {
$scope.$on('$includeContentLoaded', function(event) {
(function($) {
$(".containt").mCustomScrollbar({
autoHideScrollbar: true,
theme: "dark-3"
});
$(".scroll").mCustomScrollbar({
theme: "dark-3"
});
})(jQuery);
});
}]);
smartyet.controller('TemplateCtrl', ['$scope', function($scope) {
$scope.$on('$includeContentLoaded', function(event) {
(function($) {
$("#lightGallery").lightGallery();
})(jQuery);
});
}]);
angular.module('smartyet').controller('Ctrl1', ['$scope', function ($scope) {
$scope.finpage1='show';$scope.finpage2='';$scope.finpage3='';$scope.finchange='';
$scope.goodbyetext='hide'
$scope.active_page = 'finpage2';
$scope.togglePage1And2 = function(){
if($scope.active_page == 'finpage1'){
$scope.page2();
}else{
$scope.page1();
}
}
$scope.page1 = function(){
$scope.active_page = 'finpage1';
$scope.finchange='show';
$scope.finpage1='';
$scope.finpage2='';
$scope.finpage3='';
$scope.hellotext='hide';
$scope.goodbyetext='show'
}
$scope.page2 = function(){
$scope.active_page = 'finpage2';
$scope.finpage1='show';
$scope.finpage2='';
$scope.finpage3='';
$scope.finchange='';
$scope.hellotext='show';
$scope.goodbyetext='hide';
}
$scope.page3 = function(){
$scope.active_page = 'finpage3';
$scope.finpage2='show';
$scope.finpage1='';
$scope.finpage3='';
$scope.finchange='';
$scope.hellotext='show';
$scope.goodbyetext='hide';
}
$scope.page4 = function(){
$scope.active_page = 'finpage4';
$scope.finpage3='show';
$scope.finpage1='';
$scope.finpage2='';
$scope.finchange='';
$scope.hellotext='show';
$scope.goodbyetext='hide';
}
}])
我得到它的工作,但只有當我添加ng-app =「」身體或html標記。爲什麼ng-app需要爲空?我真的想了解包含的工作。 – kimberlyvoo
您是否想要納入ng-app? – shmck
'ng-app'設置Angular,包括在這種情況發生之前無法工作。 – shmck