2014-03-02 49 views
0

我最近學習了Angularjs,然後使用在線fiddle.net編寫angular.js代碼。起初,因爲jsfiddle不需要寫html標籤。所以我不知道應該在哪裏放置「ng-app」命令。我分享的鏈接不起作用,你是否得到同樣的問題? http://jsfiddle.net/liminjun88/Jh9K7/如何在jsfiddle中編寫Angular js代碼?

function CartController($scope){ 
       $scope.items=[ 
        {title:'Paint pots',quantity:8,price:3.95}, 
        {title:'Polka dots',quantity:17,price:12.95}, 
        {title:'Pebbles',quantity:5,price:6.95} 
       ]; 
       $scope.remove=function(index){ 
        $scope.items.splice(index,1); 
       } 
} 
+0

參見[爲什麼我需要angular.bootstrap甚至當我在JSFiddle中聲明ng-app =「MyApp」時(http://stackoverflow.com/questions/17496599/why-do-i-need-to-angular-bootstrap-even-when-i-聲明-NG-APP-MyApp的功能於jsfiddl/17498509#17498509) – Stewie

回答

0

點擊frmaework和擴展;和選擇,而不是domready中,以不換行 - 在enter image description here