天天看點

html中雙花括号顯示,角度控制器傳回空白Html頁面中的雙花括号

我正在打字與簡單的綁定應用程式。我寫了一個名為'bugCtrl'的控制器,它看起來在調試模式下工作得很好(還有console.log和alert)。這是我的html頁面角度控制器傳回空白Html頁面中的雙花括号

Bug List

There are {{ test ? '1' : '2' }} bugs (div1)

There are bugs (div2)

Descriptions : (div3)

There are {{ getLenght(); }} bugs (div4)

Display as Grid?

這是我的控制器和bugApp.js檔案:

module app {

var bugApp = angular.module("bugApp",

[]);

}

module app.controller {

interface IWorkItems {

description: string;

status: string;

getView?(): string;

}

class BugCtrl {

workItems: Array;

test: string;

constructor($scope, $timeout) {

this.workItems = [

{ description: "Severe bug", status: "Open" },

{ description: "Minor bug", status: "Closed" }

];

this.test = "BBB";

alert(this.workItems[0].description);

console.log(this.workItems.length.toString());

console.log(this.workItems[0].description);

}

getLenght(): string {

return this.workItems.length.toString();

}

}

angular

.module("bugApp")

.controller("bugCtrl", BugCtrl);

}

這看起來很簡單但我不能在這裡解決問題。這是 the result I get: