我可以在两个模板URL之间有一个选项。像这样:单个指令中的可选/多个模板URL Angular JS
angular.factory('SAMPLE',function(){
return {
getnDetails:function($http){
return $http({
method: 'GET',
url: url
});
}
)};
angular.directive() {
controller : function($scope) {
SAMPLE. getnDetails().sucess(){
}.error() {
templateURL: "zbx.html"
}
templateUrl : "xyz.html"
}
这样,当我的http请求是一个错误加载完全不同的模板。什么是这样的最好的方式。