angularJS绑定无法正常工作

时间:2013-06-05 01:50:37

标签: javascript node.js binding angularjs pug

我对Angular和Jade有疑问。我的index.jade看起来像这样:

extends ../layouts/default

block content
  script(type='text/javascript', src='/js/angular.js')
  script(type='text/javascript', src='./controllers.js')

  ul(ng-controller='PhoneListCtrl')
    li(ng-repeat='phone in phones')
      {{phone.name}}
      p {{phone.snippet}}

和我的角度控制器看起来像这样:

'use strict';

/* Controllers */

function PhoneListCtrl($scope) {
  $scope.phones = [
    {"name": "Nexus S",
     "snippet": "Fast just got faster with Nexus S.",
     "age": 0},
    {"name": "Motorola XOOM™ with Wi-Fi",
     "snippet": "The Next, Next Generation tablet.",
     "age": 2},
    {"name": "MOTOROLA XOOM™",
     "snippet": "The Next, Next Generation tablet.",
     "age": 1}
  ];
}

我的问题是当我运行代码时,index.jade中的绑定不起作用。所以我有点迷茫,因为我不知道为什么。谢谢你的帮助

0 个答案:

没有答案