Created
December 19, 2017 01:55
-
-
Save guyoun/17da53e6e29227ad1b7244b0eef80d83 to your computer and use it in GitHub Desktop.
templateProvider 사용하여 동적으로 template 적용하기
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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