2016-03-08 81 views
1

這裏是我的代碼:Angular/JADE - 爲什麼在嘗試在ng-href屬性中使用Angular標記時收到錯誤「Unexpected token {」?

extends layout 

block content 
h1= title 
p User Directory 

// Wrapper 
#wrapper 

    input(type='text', placeholder='Search Users...') 
    h2 User List 

    // USER LIST 
    div(ng-controller='UserListCtrl') 
     #UserList 
      table 
       thead 
        th UserName 
        th DOB 
       tbody 
       tr(ng-repeat='user in users') 
        td: a(ng-href='/users/{{user.id}}')= {{user.fc}} 
        td {{user.birthYear}} 
    // /USER LIST 

// /WRAPPER 

與錨標記的行返回一個「意外令牌{」的錯誤。我嘗試了很多變化;只使用href,連接字符串等。我從字面上開始學習這個,所以請原諒我的一些無知,如果我犯了一個簡單的錯誤。

+0

'{{user.fc}}'應該是字符串,任何適當的編輯器都會立即突出顯示 – maurycy

+0

哦,我明白了。將int作爲字符串輸出的最佳方式是什麼? – NeedsHelp

回答

0

你試過嗎?

td: a(ng-href='/users/'+{{user.id}})= {{user.fc}} 
相關問題