Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a problem with Angular and Jade. I have my index.jade that it looks like this:

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}}

and my angular controller which looks like this:

'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}
  ];
}

And my problem is when I run the code the bindings in the index.jade don't work. So i'm kind of lost because I don't know why. Thanks for your help

share|improve this question
The markup ng-app is in my layouts/default I tested and it works with a simple two-way binding data with an input. But when I decided to add the scope Phones the binding doesn't work – user967001 2 days ago
Try moving the script part of the code in the template to the bottom of the template - that is move the code such that it is the last code in the template. Check if this works. – callmekatootie yesterday

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.