我正在处理一个简单的角度/玉石模板,我在尝试将信息加载到模板时遇到错误。
layout.jade:
doctype
html(ng-app)
head
title= title
script(type='text/javascript', src='javascripts/lib/angular.min.js')
script(type='text/javascript', src='javascripts/lib/angular-resource.min.js')
script(src='//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js')
script(type='text/javascript', src='public/javascripts/app2.js')
link(rel='stylesheet',type='text/css', href='/stylesheets/boostrap.css')
body
block content
index.jade:
extends layout
block content
h1= title
div(ng-controller='AppCtrl')
h1 Angulair
ul(ng-app=ng-repeat="airport in airports")
li {{ airport.code }}
li {{ airport.name }}
li {{ airport.destination }}
app2.js:
function AppCtrl ($scope) {
$scope.airports = {
"PDX": {
"code": "PDX",
"name": "Portland",
"destination": "Toronto"
},
"LAX": {
"code": "LAX",
"name": "Los Angeles",
"destination": "Toronto"
}
};
}
我一直收到这个错误:
500 ReferenceError:/ Users / AllanAraujo / Desktop / testapp 5 / views / index.jade:7
5 | div(ng-controller ='AppCtrl')
6 | h1 Angulair
> 7 | ul(ng-app = ng-repeat =“机场机场”)
8 | li {{airport.code}}
9 | li {{airport.name}}
10 | li {{airport.destination}}
分配中的左侧无效
我是jade / angular的新手,所以我对这个错误是什么感到困惑。任何帮助表示赞赏。
答案 0 :(得分:1)
我认为这是因为index.jade中的以下行:
ul(ng-app=ng-repeat="airport in airports")
ng-app
和ng-repeat
是属性。您需要使用逗号分隔它们:
ul(ng-app, ng-repeat="airport in airports")