在项目中,由于要兼容到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) {
                ... ...
            }
        };
    }]);

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-04-19
  • 2021-11-28
猜你喜欢
  • 2022-12-23
  • 2021-06-16
  • 2022-12-23
  • 2021-11-28
  • 2021-11-28
  • 2021-11-28
  • 2021-07-18
相关资源
相似解决方案