zoukankan      html  css  js  c++  java
  • AngularJS自定义指令(Directives)兼容IE8的方法

    在项目中,由于要兼容到IE8,我使用1.2.8版本的angularJS。这个版本是支持自定义指令的。

    原本的代码写法:

    HTML:

    <pagination></pagination>

    JS:

    .directive('pagination', ["$rootScope",
            function ($rootScope) {
            return {
                restrict: 'E',
                templateUrl: "./html/maintain/pagination.html",
                link: function ($scope, elem, attr) {
    
                    ... ...
    
                    };
                }
            };
        }]);

    能够兼容IE8的写法:

    HTML:

    <div pagination></div>

    JS:

    .directive('pagination', [ "$rootScope",
            function ($rootScope) {
            return {
                templateUrl: "./html/maintain/pagination.html",
                link: function ($scope, elem, attr) {
                    ... ...
                }
            };
        }]);
  • 相关阅读:
    小程序 scroll-view 中文字不换行问题
    模块
    网络编程
    元类
    day24
    day23
    day22
    day21
    day18
    day17
  • 原文地址:https://www.cnblogs.com/miny-simp/p/8079279.html
Copyright © 2011-2022 走看看