zoukankan      html  css  js  c++  java
  • angularjs自定义filter

    angular.Module API

    Overview
    Methods
    info([info]);
    provider(name, providerType);
    factory(name, providerFunction);
    service(name, constructor);
    value(name, object);
    constant(name, object);
    decorator(name, decorFn);
    animation(name, animationFactory);
    filter(name, filterFactory);
    controller(name, constructor);
    directive(name, directiveFactory);
    component(name, options);
    config(configFn);
    run(initializationFn);
    Properties
    requires
    name
    

    filter(name, filterFactory);

    See $filterProvider.register().

    Note: Filter names must be valid AngularJS Expressions identifiers, such as uppercase or orderBy. Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace your filters, then you can use capitalization (myappSubsectionFilterx) or underscores (myapp_subsection_filterx).
    --Parameters--
    Param Type Details
    name string
    Filter name - this must be a valid AngularJS expression identifier

    filterFactory Function
    Factory function for creating new instance of filter.

    Demo

        angular.module('mobile')
            .filter('mobileMask', function() {
                return function(input) {
                    var mobile = input || '';
                    var reg = /d{11}/;
                    if (reg.test(mobile)) {
                        return mobile.replace(/(d{3})(d{4})(d{4})/, '$1****$3');
                    }
                    return input;
                }
            });
    
  • 相关阅读:
    xhr单体工厂(采用分支)
    js,div垂真居中
    pycharm快捷键
    设计模式
    WebDriver API
    单元测试框架
    python操作MySQL数据库
    python读取和写入csv文件
    搭建自动化测试环境
    java中不带package和带package的编译运行方式
  • 原文地址:https://www.cnblogs.com/wancy86/p/9226222.html
Copyright © 2011-2022 走看看