AngularJS directive 動態 template

app.directive('testwindow', function() {
return {
    restrict : 'E',
    template: '<ng-include src="getTemplateUrl()"/>', 
    replace: true,
    controller:function($scope, $element ,$http){

        $scope.getTemplateUrl=function(){
            var url= getWebRoot() + "/views/"+             
            $scope.dataStore.elementType +".html";
            return url;
    };
}        

是個比較好的解決方案,markhtml

相關文章
相關標籤/搜索