1
У меня есть два списка, я конкатюю их без дубликата vlaue, я делаю это, поэтому у меня есть дублирующее значение, почему ..?Конкат-лист без дубликата
В Мой HTML:
..
<list-of-items items="platforms.concat(platformsCible).unique()"
label="$item"
selected-item="platform"
createfunction="add_platform($name)"
selectable="true"
editable="false"
size="small">
</list-of-items>
..
В Мой JS
propertiesModule.controller('PropertiesCtrl', ['$scope', '$routeParams', 'PropertiesService', 'ApplicationService', 'PlatformService', 'Page', function ($scope, $routeParams, PropertiesService, ApplicationService, PlatformService, Page) {
...
$scope.platforms = [];
/* Find all the platforms */
PlatformService.get($routeParams.application, $routeParams.version).then(function(platforms){
$scope.platforms = platforms;
}).then(function(){
/* If platform was mentionned in the route, try to find it or add it */
if($scope.platform) $scope.add_platform($scope.platform);
});
/* Find all the platforms cible */
if($routeParams.versionCible != null) {
PlatformService.get($routeParams.application, $routeParams.versionCible).then(function (platforms) {
$scope.platformsCible = platforms;
}).then(function() {
/* If platform was mentionned in the route, try to find it or add it */
if ($scope.platformCible) $scope.add_platform($scope.platformCible);
});
}
Array.prototype.unique = function() {
var a = this.concat();
for(var i=0; i<a.length; ++i) {
for(var j=i+1; j<a.length; ++j) {
if(a[i] === a[j])
a.splice(j--, 1);
}
}
return a;
};
}]);
Thx
Опубликовать пример «платформ». – dfsq
@dfsq i Опубликовать пример платформ – Mercer