2014-02-14 26 views
4

我有這樣的佈局。我使用passsy擴展名爲angular masonry。每當我用它在AngularJS中使用Angular Marquisry?

<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> 

瀏覽器是越來越忌用。用工具調試腳本說element.masonry不是一個函數。

任何幫助,將不勝感激!

+1

爲什麼不使用磚石作爲上市? https://github.com/passy/angular-masonry – mainguy

+1

@mainguy我正在整合passy的角石工。但有一些問題。如果你已經使用它。請檢閱我的問題任何幫助,將不勝感激 –

回答

2

嗯,目前我從我家裏的筆記本電腦上工作,我無法讓Passy的版本運行,也無法指出問題。但是,這是我能爲您提供關於現在:

我做了基於東西很簡單的指令,我在什麼地方閱讀:

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); 
    } 
    }; 

正如你可以看到它不現在有任何選項。當我在星期一工作時,我會在適當的雙屏幕顯示屏上查看我的源代碼,併爲您提供更好的版本。 我的妻子開始給我外表,我現在需要把筆記本電腦拿走。 : - \

你可以看到in this plunker它現在有點用了。也許這可以幫助你。在此期間,你可以添加一些你的json數據到你的問題嗎?現在有一個愉快的週末!

+0

謝謝你!那麼我想通了。帕西正在工作! 。現在需要爲passy數據加載一些數據優化 –

+2

@Creator你能分享你如何修復它嗎? – Moon

-4

我有這個錯誤,通過包括原始的砌體代碼修復它。我也認爲這是一個純粹的角度端口。

0

爲了得到帕西的angularjs指令工作,你必須包括所有的文件每個索引文件