小编its*_*ara的帖子

根据下拉列表1选择填充下拉列表2

我可以直接从数据库中填充2个下拉列表.我的问题是,必须根据第一个下拉选择填充第二个下拉值.由于我是Angular的新手,我无法弄明白,有人可以帮我解决这个问题.

<select id="OfficeId" name="OfficeId" ng-model="item.OfficeId"
        ng-options="item.OfficeId as item.OfficeName for item in Offices">
    <option value="" selected>Select the Office</option>
</select>
<select id="OBJ" name="OBJ" ng-model="item.OfficeOBJId"
        ng-options="item.OfficeOBJId as item.OBJId for item in Codes">
    <option value="" selected>Select OBJ Code</option>
</select>

myApp.factory('OfficeNames', function ($resource) {
    return $resource(
        'api/Office/:id',
        { id: '@id' },
        { update: { method: 'PUT' } }
    );
});     

myApp.factory('OfficeObjCode', function ($resource) {
    return $resource(
        'api/OfficeObj/:id',
        { id: '@id' },
        { update: { method: 'PUT' } }
    );
});

function OfficeCtrl($scope, $location, OfficeNames) { …
Run Code Online (Sandbox Code Playgroud)

angularjs

15
推荐指数
1
解决办法
4万
查看次数

标签 统计

angularjs ×1