Angularjs选择选项ng-change不起作用

时间:2016-06-22 07:51:39

标签: javascript angularjs angularjs-select

我正在使用简单的angularjs选择选项。每件事都很好,但ng-change不起作用。任何具体原因?我尝试过使用带有&select; 。但这也没有解雇。所以我猜选择改变不会发生。任何帮助为什么会这样?

HTML

<div class="col-md-12 n-p" ng-controller="PartStructureEditController">
    <div class="col-md-12 n-p pull-left">
        <div class="col-md-6">
            <label for="ToolDes">Parent Level / Part Number :</label><br />
            <select ng-options="object.combine as (object.Level + ' / ' + object.PartNo) for object in parentDropdown track by object.PartStructureId" ng-model="selectedParent"  ng-change="changeParent()" class="form-control">
            </select>
        </div>
    </div>
</div>

控制器

(function () {
    'use strict';
    MyApp.controller('PartStructureEditController', ['$rootScope', '$scope', 
       function ($rootScope, $scope) {
           function populateDropDown(data, ParentPartStructureId) {
               var result = [];
               data.map(function (a) {
                   if ((parseInt(a.ParentPartStructureId) !== ParentPartStructureId) || (parseInt(a.PartStructureId) !== ParentPartStructureId)) {
                       result.push(a);
                   }
               });
               $scope.parentDropdown = result;
               $scope.selectedParent = result[result.length - 1];
           }
           $scope.changeParent = function(){
                console.log('something');   
           }
       }]);
})();

0 个答案:

没有答案