【发布时间】:2014-11-29 08:22:34
【问题描述】:
我在 AngulrJS 中创建了一个directive。
下面是我的sample.html
<uservalue user="user.userlist" change-user='user()'></uservalue >
下面是我的用户价值库
app.directive('uservalue ', function() {
return {
scope: {
user:'=',
changeUser: '&',
readonly: '@',
valueChange: '='
isClickable: '@'
},
restrict: 'AE',
replace: true,
templateUrl: 'app/partials/template.html',
});
}
从这里它重定向到template.html
下面是我的template.html
<select><option value="">Choose user</option>
<option id = "username" data-ng-repeat="c in user" value="{{c.key}}">{{c.value}} </option>
</select>
我可以在下拉列表中显示sample.html 中的所有用户,并且在更改下拉列表中的值时,它会转到另一个js,即user()。现在我的要求是我必须将下拉选择的值发送到user() js 函数。
任何建议!!!
【问题讨论】:
标签: html angularjs angularjs-directive