有一点问题,我有一个页面通过页面转换路由到ng-view。问题是我有一个幻灯片库,需要在显示页面之前构建..似乎找不到延迟页面转换的方法..我已经阅读了一些关于ngCloak并试图将它放在我的主页模板上但是似乎什么也没做......
希望你们能让我朝着正确的方向前进..
homeController.js
angular.module("sportsStore")
.controller("homeCtrl", function ($scope) {
$scope.pageClass = 'page-home';
$scope.quantity = 4;
})
homeCtrl.slider = function ($timeout) {
return {
templateUrl: "AngularJS/views/sliderTemplate.html",
compile: function compile(tElement, tAttrs, transclude) {
return function (scope, element, attrs) {
$timeout((function() {
return element.flexslider({
animation: "slide",
controlNav: false,
directionNav: true,
nextText: "<i class='fa fa-angle-right'></i>",
prevText: "<i class='fa fa-angle-left'></i>",
});
}), 0);
}
}
}
};
路线
.config(function ($routeProvider) {
$routeProvider.when("/complete", {
templateUrl: "AngularJS/views/thankYou.html"
});
$routeProvider.when("/placeorder", {
templateUrl: "AngularJS/views/placeOrder.html"
});
$routeProvider.when("/checkout", {
templateUrl: "AngularJS/views/checkoutSummary.html"
});
$routeProvider.when("/products", {
templateUrl: "AngularJS/views/productList.html",
controller: "productListCtrl"
});
$routeProvider.otherwise({
templateUrl: "AngularJS/views/homeView.html",
controller: "homeCtrl"
resolve: homeCtrl.slider
});
})