我已经实现了角度pinterest - 在我的单页应用程序中,可以在这里找到:
https://github.com/cornflourblue/angular-pinterest/
使用以下内容在我的应用程序中一切正常:
<pin-board username="'pointblankdev'" board-name="'point-blank-development'" image-width="'200'" board-height="'140'" board-width="'250'"></pin-board>
然而,当我尝试将数据绑定实现到 board-name 时它没有返回任何内容,这就是我的代码:
<pin-board username="'username'" board-name="'{{getPinBoard}}'" image-width="'267'" board-height="'1149'" board-width="'1149'"></pin-board>
这是在我的指令中:
$scope.$watch('getPinBoard', function() {
var url = $scope.lookName;
var urlToLower = url.replace(/\s+/g, '-').toLowerCase();
$scope.UrlLower = urlToLower;
});
但是刚回来:
{{getPinBoard}}
给我正确的董事会名称。
这是我的指示:
app.directive('pinterestBoard', function ($window) {
return {
restrict: 'AE',
scope: {
lookName: '=lookName',
pinBoard: '=pinBoard',
columns: '=columns',
muses: '=muses',
boardPadding: '=boardPadding',
boardHeight: '=boardHeight'
},
templateUrl: 'app/templates/pinterest.board.html',
link: function ($scope, element, attrs) {
var resizeEnded;
$scope.getPinBoard( function() {
var url = $scope.lookName;
var urlToLower = url.replace(/\s+/g, '-').toLowerCase();
$scope.UrlLower = urlToLower;
});
}
};
});
任何帮助都会很棒。