How to initiate MixItUp with AngularJS NgRoute

前端 未结 4 1016
囚心锁ツ
囚心锁ツ 2021-01-18 07:55

I\'ve been setting up a jquery plugin MixItUp with AngularJS and although I can successfully initiate the container during one of my partial views with NgRoute, once I move

4条回答
  •  时光取名叫无心
    2021-01-18 08:33

    As @demkalkov suggest use a directive and load mix-it-up related html as template like

    .directive('mixItUp', function(){
        return{
          restrict: 'AEC',
          templateUrl: 'mix-it-up-tpl.html',
          link: function(scope, element){             
             $(element).mixItUp();
          }
        }
      })
    

    Use the directive in html as

    And lets say your mix-it-up.html looks like

    Here is a working Demo

    Note - In Angular context directive is the ideal place to manipulate html or plugin integration.

提交回复
热议问题