1
두 개의 목록이 있습니다. 중복 된 vlue없이 연결됩니다. 그래서이 값을 복사합니다. 이유는 무엇입니까? 내 HTML에서중복되지 않은 concat 목록
: 내 JS에서
..
<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>
..
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;
};
}]);
들으
'플랫폼'의 예입니다. – dfsq
@ dfsq 플랫폼 예보기 – Mercer