Skip to content

Instantly share code, notes, and snippets.

@guyoun
Created December 19, 2017 01:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guyoun/17da53e6e29227ad1b7244b0eef80d83 to your computer and use it in GitHub Desktop.
Save guyoun/17da53e6e29227ad1b7244b0eef80d83 to your computer and use it in GitHub Desktop.
templateProvider 사용하여 동적으로 template 적용하기
.state('order', {
url: "/order",
templateUrl: "views/" + theme_path +"/order/order.html",
controller: 'AdminOrderCtrl',
data: { pageTitle: 'Order' }
})
.state('order.view', {
url: "/view/:id",
templateProvider: ['$timeout', '$stateParams', 'AuthService', function ($timeout, $stateParams, AuthService) {
return $timeout(function () {
var include_url = "views/" + theme_path + "/order/view.html";
if(AuthService.isAuthorized('cs')){
include_url = "views/" + theme_path + "/order/cs-view.html";
}
else if(AuthService.isAuthorized('reseller')){
include_url = "views/" + theme_path + "/order/reseller-view.html";
}
var html = '<div ng-include="\''+include_url+'\'"></div>';
return html;
}, 100);
}],
data: { pageTitle: 'Order' }
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment