所以,我有一個選擇列表,我試圖動態選擇項目。是,甚至母鹿表達的東西被評估爲「真」的選項仍然沒有被選中ng選中true,但不選
<label for="articlePage">Page:</label>
<select class="form-control pageList" name="articlePage" required="" ng-model="article.page_ID">
<option ng-repeat="page in pages" ng-selected ="{{page.id == article.page_ID}}" value={{page.id}}>{{page.name}}</option>
</select><br>
範圍(頁):
$scope.pages = [
{ name: "Home", id: "1" },
{ name: "Plugs", id: "2" },
{ name: "Pack Bedding", id: "3" },
{ name: "Pot Bedding", id: "4" },
{ name: "Poinsettias", id: "5" },
{ name: "Sales", id: "6" },
{ name: "Process Quality", id: "7" },
{ name: "Environment", id: "8" },
{ name: "Process Technology", id: "9" },
{ name: "Process Control", id: "10" },
{ name: "Infrastructure", id: "11" },
{ name: "News", id: "12" },
{ name: "About", id: "13" },
{ name: "Contact", id: "14" },
{ name: "Find Us", id: "15" },
{ name: "Key Personnel", id: "16" },
{ name: "Recruitment", id: "17" },
{ name: "Legal Information", id: "18" },
{ name: "Hidden", id: "19" }
];
也有被檢索的服務我的文章,我知道我得到的權利,就像我說的,表達正在評估。這裏是打印屏幕證明:
沒有任何人有任何想法,爲什麼沒有被選中的選項?
謝謝! :)
嘗試使用角度表達NG選擇,喜歡在這裏的例子:https://docs.angularjs.org/api/ng/directive/ngSelected – neptune