我正在尝试包含模板侧边栏,但它无法正常工作。它只是显示包含应该在哪里的空白点。我每次尝试使用它时都遇到麻烦。有什么我做错了吗?
这是我的代码:
<html ng-app="smartyet">
包括:
<div ng-include="'/assets/includes/controls.html'" ng-app="smartyet"></div>
App:
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';
}
}])
答案 0 :(得分:0)
尝试在ng-include
之前加载应用。仅加载ng-app
一次。
<html ng-app="smartyet">
<div ng-include="'assets/includes/controls.html'"></div>
</html>