小编给大家分享一下Angularjs如何自定义一个可输入的下拉框组件,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!

在 angularjs 中自定义一个可输入的下拉框组件,组件的创建及引入如下。
新建 insertSelect.html 文件
directive 自定义指令
//可输入select框
angular.module("controllers")
.directive("insertSelect", [function () {
return {
restrict: 'AE',
templateUrl: 'template/common/insertSelect.html',
scope: {
modelData: '=modelData',
optionList: '=optionList',
placeholder: '=placeholder', //placeholder 可由引入页面传入
},
link: function ($scope, $elem) {
//
},
controller: ["$scope", function ($scope) {
}]
}
}]);页面引入 insertSelect 组件
看完了这篇文章,相信你对“Angularjs如何自定义一个可输入的下拉框组件”有了一定的了解,如果想了解更多相关知识,欢迎关注创新互联行业资讯频道,感谢各位的阅读!