繼斯科特·艾倫的第一個代碼(簡單)sample,之後下拉條目改變有線NG-模型不刷新此NG-選項不刷新有線標籤時下拉改變
{{ engineer.currentActivity}}
瀏覽器:FF 50.1.0
角:1.5.9
的jQuery:1.7
HTML:
<div ng-controller="EngineeringController">
{{engineer.name}} is currently : {{engineer.currentActivity}}
<div>
choose an activity:
<select id="agDDLClient" ng-model="EngineeringController.currentActivity" ng-options ="act for act in activities">
</select>
</div>
<input type="button" ng-click="what()" value="check" />
</div>
JS:
var aIS = angular.module("app", []);
aIS.controller("EngineeringController", function($scope, $http)
{
$scope.engineer = {
name: "Dani",
currentActivity: "Fixing bugs"
};
$scope.activities =
[
"Writing code",
"Testing code",
"Fixing bugs",
"Dancing"
];
$scope.what = function(){ alert($scope.engineer.currentActivity);}
});
非常好,謝謝! – Jeb50
剛回去看到Scott的HTML使用「engineer.currentActivity」。我做的是複製粘貼,不知道發生在我身上的事情。 :( – Jeb50