AngularJS:选择项目后未触发
我使用的是angularjs版本1.6.4,带有多选择模块。一切正常。我可以从建议中进行选择,但每当我进行选择时,“选择项目后”指令不会触发。根据angular multiple select模块文档 afterSelectItem:在添加项之前侦听事件AngularJS:选择项目后未触发,angularjs,multi-select,Angularjs,Multi Select,我使用的是angularjs版本1.6.4,带有多选择模块。一切正常。我可以从建议中进行选择,但每当我进行选择时,“选择项目后”指令不会触发。根据angular multiple select模块文档 afterSelectItem:在添加项之前侦听事件 技能 我的控制器有几个代码行: (function () { "use strict"; var module = angular.module(__appName); function fetchSkills($
技能
我的控制器有几个代码行:
(function () {
"use strict";
var module = angular.module(__appName);
function fetchSkills($http) {
return $http.get(__apiRoot + "/skills")
.then(function (response) {
return response.data;
})
}
function controller($http) {
var model = this;
model.$onInit = function () {
fetchSkills($http).then(function (skills) {
model.skills = skills;
});
};
model.afterSelectItem = function (item) {
console.log("after select item");
console.log(item);
}
}
module.component("userEdit", {
templateUrl: "components/user-edit/user-edit.template.html",
bindings: {
userId: "<",
onUserSaved: "&"
},
controllerAs: "model",
controller: ["$http", controller]
});
(函数(){
“严格使用”;
var module=angular.module(_appName);
函数fetchSkills($http){
返回$http.get(uuu apiRoot+“/skills”)
.然后(功能(响应){
返回响应数据;
})
}
函数控制器($http){
var模型=此;
模型。$onInit=函数(){
fetchSkills($http)。然后(函数(skills){
模型。技能=技能;
});
};
model.afterSelectItem=功能(项目){
console.log(“选择项之后”);
控制台日志(项目);
}
}
module.component(“userEdit”{
templateUrl:“组件/用户编辑/用户编辑.template.html”,
绑定:{
用户ID:“
(function () {
"use strict";
var module = angular.module(__appName);
function fetchSkills($http) {
return $http.get(__apiRoot + "/skills")
.then(function (response) {
return response.data;
})
}
function controller($http) {
var model = this;
model.$onInit = function () {
fetchSkills($http).then(function (skills) {
model.skills = skills;
});
};
model.afterSelectItem = function (item) {
console.log("after select item");
console.log(item);
}
}
module.component("userEdit", {
templateUrl: "components/user-edit/user-edit.template.html",
bindings: {
userId: "<",
onUserSaved: "&"
},
controllerAs: "model",
controller: ["$http", controller]
});