私のプロジェクトでは、jquery組積造を実装しようとしています。しかし、それは機能し始めています。グーグルしてみましたが、投稿が見つかりました。しかし、私はそれが機能しないことを試しました。
私のディレクティブコードは
shout.directive("shoutList", function($timeout) {
return {
restrict : 'E',
replace : true,
templateUrl : 'views/shout/shout-list.html',
scope : {
shouts : "="
},
//require : "ShoutController",
controller : function($scope) {
$scope.deleteShout = function() {
console.log('shout deleted');
}
},
link : function(scope, element, attr) {
scope.$watch('shouts', function() {
// console.log("changing......");
// scope.$evalAsync(
document.getElementById("shout-content-holder").masonry({
itemSelector: '.shout'
})
// );
});
}
}
});
ディレクティブテンプレートは
<div id="shout-content-holder">
<div class="shout" ng-repeat="shout in shouts">
<p>{{shout.message}}</p>
<img src="media/images/delete.png" width="32" height="32" ng-click="deleteShout()"/>
</div>
</div>
Webサービスからシャウトをロードします。この作品を作るのを手伝ってください...