Using Angular Freemasonry in AngularJS?

I have such a layout. I use the extension passsyfor angular masonry.

<masonry column-width="200">
    <div class="masonry-brick" ng-repeat="data in comments">
       <div ng-switch on="data.type">
         <div ng-switch-when="hoots">         
           <article class="hoot_main">
           //content goes here
           //hoot_main is the main class for this div layout
           </article> 
          </div>
        </div>
      </div>
      <div ng-switch on="data.type">
       <div ng-switch-when="article">         
        <article class="hoot_main">
         //content goes here
         //hoot_main is the main class for this div layout
        </article> 
      </div>
     </div>
      <div ng-switch on="data.type">
        <div ng-switch-when="story">         
          <article class="hoot_main">
           //content goes here
           //hoot_main is the main class for this div layout
          </article> 
       </div>
      </div>
   </div>
 </masonry>

The browser gets hung when I use it. Debugging a script with tools says it is element.masonrynot a function.

Any help would be appreciated!

+4
source share
3 answers

Hmm, at the moment I’m working from my laptop at home, and I can’t get a passive version and also can’t feel this problem. But here is what I can offer you now:

I made a very simple directive based on the things I read somewhere:

app.directive('masonry', function() {
  return {
    restrict: 'AC',
    controller: function($scope) {
      return $scope.$watch(function(e) {
        $scope.masonry.reloadItems();
        return $scope.masonry.layout();
      });
    },
    link: function(scope, elem, attrs) {
      var container=elem[0];
      var options='';
      return scope.masonry = new Masonry(container,options);
    }
  };

, - . , . , .: -\

, . , . json ? -!

+2

passy angularjs, ,

                                                                                          

0

, ​​, . , angular.

-4

Source: https://habr.com/ru/post/1526941/


All Articles