加载Angular JS控制器时出错

时间:2015-01-20 19:42:01

标签: javascript html angularjs

<html>
<body ng-app="testApp" ng-controller="testControl">    
    <ul>
       <li ng-repeat="x in phones">
           {{x.name}}<br />{{x.title}}
       </li>    
    </ul>
 </body>   
</html>

JS档案

var testApp = angular.module('testApp', []);

testApp.controller('testControl', function($scope){
    $scope.phones = [
        {name: 'iPhone 6', title: 'Apple created'},
        {name: 'Samsumg Galaxy 2', title: 'Samsung created'}
    ];
});

JS Fiddle

http://jsfiddle.net/Lxk5p905/

1 个答案:

答案 0 :(得分:3)

小提琴选项=&gt; No wrap in <head>

JSFiddle Link - 没有更改代码