1

FiddleAngularJS:JS小提琴無法加載資源

這裏是我的角度代碼:

angular.module('TM', []) 

.controller('protocolCtrl', function(){ 
    this.categoryText = 'Now looking at the protocol part' 
}) 

.controller('categoryCtrl', function(){ 
    this.protocolText = 'Now looking at the category part' 
}) 

.directive('modalDirective', function(){ 
    return { 
     restrict: 'E', 
     scope: { 
      list: '=' 
     }, 
     template: ['<div id="modal" class="modal fade" role="dialog">', 
         '<div class="modal-dialog">', 
         '</div>', 
         '</div>'].join('') 
    } 
}); 

如果我直接在HTML文件中使用HTML模板,它顯示,而不是其他。

的錯誤是希望真的不起眼,但是任何幫助表示讚賞。

+0

你有沒有在僅僅使用用戶界面,引導模式採取看看嗎? https://angular-ui.github.io/bootstrap/它會爲你做這一切。 – mikeswright49

+0

你的角JS不會在你的小提琴中加載。 404 –

+0

工作正常..只需要修理你的小提琴。改爲使用此鏈接.. https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js這裏是一個演示.. https://jsfiddle.net/DTcHh/10131/ –

回答

2

你的代碼似乎很好。但是你的小提琴中的角色鏈接被打破了。在製作Angular JS小提琴時,您應該從Angularjs.org網站複製CDN URL並將其添加爲JS小提琴的外部資源。

enter image description here

https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js 

演示:

https://jsfiddle.net/DTcHh/10131/

+0

真棒 - 謝謝:) –

+0

如果你有時間 - 我真的很感激,如果你可以看看這個還有:http://stackoverflow.com/questions/31516980/passing-in-parameters-when-calling- a-directive-in-angularjs/31520413#31520413 –

+0

@ Nilzone-,你是否爲這個問題開始小提琴? –