Ways to improve AngularJS performance even with large number of DOM elements

前端 未结 6 477
自闭症患者
自闭症患者 2021-02-02 11:14

I\'m evaluating whether or not to use AngularJS for a web project, and I\'m worried about the performance for a feature I need to implement. I would like to know if there\'s a

6条回答
  •  你的背包
    2021-02-02 11:25

    I think that the best way to solve performance issues is to avoid using high level abstractions (AngularJS ng-repeat with all corresponding background magic) in such situations. AngularJS is not a silver bullet and it's perfectly working with low level libraries. If you like such functionality in a text block, you can create a directive, which will be container for text and incapsulate all low level logic. Example with custom directive, which uses letteringjs jquery plugin:

    angular.module('myApp', [])
      .directive('highlightZone', function () {
        return {
          restrict: 'C',
          transclude: true,
          template: '
    ', link: function (scope, element) { $(element).lettering('words') } } })

    http://jsfiddle.net/j6DkW/1/

提交回复
热议问题