到第一循環,恢復我的ID,我嘗試這樣定義其他循環:動態可變進angularjs NG-重複
<ul ng-show="feed{{raterie.idFB}} === true" ng-init="var myFeed = myFeedFunction(raterie.idFB);">
<li ng-repeat="feed in getFeeder(raterie.idFB) | limitTo:1">adoptions are : {{feed.title | cleanit}}</li>
<li ng-repeat="feed in feeder{{raterie.idFB}} | limitTo:1">adoptions are : {{feed.title | cleanit}}</li>
<li ng-repeat="feed in feeder{raterie.idFB} | limitTo:1">adoptions are : {{feed.title | cleanit}}</li>
<li ng-repeat="feed in feeder[raterie.idFB] | limitTo:1">adoptions are : {{feed.title | cleanit}}</li>
<li ng-repeat="feed in feeder['raterie.idFB'] | limitTo:1">adoptions are : {{feed.title | cleanit}}</li>
<li ng-repeat="feed in myFeed | limitTo:1">adoptions are : {{feed.title | cleanit}}</li>
<li ng-repeat="feed in feeder846097918756247 | limitTo:1">adoptions is : {{feed.title | cleanit}}</li>
<ul>
我不明白如何讓「feeder846097918756247」自動構造。最後李是我想要得到的,我把它放在手動只是一個例子爲第一循環
我嘗試兩種解決方案在$範圍:
// define the value for ng-repeat (1st solution)
$scope.getFeeder = function(id) {
var idr = 'feeder' + id;
return idr;
}
// define the value for ng-repeat (2nd solution)
function myFeedFunction(pId) {
return eval('feeder' + pId) ;
}
它不起作用。
我的在線應用程序是在這裏:http://www.monde-du-rat.fr/pmr/
對不起,不知道你是問。而不是指向您的實時鏈接。準備一個plunkr並解釋問題陳述。 – PSL 2014-10-19 00:29:23
我想讓'feeder846097918756247'自動構建。最後一個是我想要得到的,我把它手動顯示我的預期。 '846097918756247'就是這種情況{{raterie.idFB}} – JoDiii 2014-10-19 00:33:00
在getFeeder中,如果你做了'返回$ scope [idr]'會發生什麼? – PSL 2014-10-19 00:34:34