Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
AngularJS:选择项目后未触发_Angularjs_Multi Select - Fatal编程技术网

AngularJS:选择项目后未触发

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($

我使用的是angularjs版本1.6.4,带有多选择模块。一切正常。我可以从建议中进行选择,但每当我进行选择时,“选择项目后”指令不会触发。根据angular multiple select模块文档

afterSelectItem:在添加项之前侦听事件


技能
我的控制器有几个代码行:

(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]
});