新网创想网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

Angularjs如何自定义一个可输入的下拉框组件

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

饶平网站制作公司哪家好,找创新互联公司!从网页设计、网站建设、微信开发、APP开发、响应式网站等网站项目制作,到程序开发,运营维护。创新互联公司2013年至今到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联公司

在 angularjs 中自定义一个可输入的下拉框组件,组件的创建及引入如下。

新建 insertSelect.html 文件


    .insert-select {
        position: relative;
    }
 
    .input-box {
        position: absolute;
        height: calc(100% - 4px);
        width: calc(100% - 25px);
        top: 2px;
        left: 2px;
        padding-left: 10px;
        outline: none !important;
        border-radius: 4px !important;
        border: none !important;
    }
 

 


    
        
    
 
    

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如何自定义一个可输入的下拉框组件”有了一定的了解,如果想了解更多相关知识,欢迎关注创新互联行业资讯频道,感谢各位的阅读!


当前文章:Angularjs如何自定义一个可输入的下拉框组件
文章源于:http://www.wjwzjz.com/article/gegghd.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP