Некрасивый вариант , зато свой
(function () {
'use strict';
angular
.module('app.widgets')
.directive('ccTags', ccTags);
function ccTags() {
var directive = {
scope: {
label: "@"
dictionary: "=dictionaryList",
arrM: '=arrayModel'
},
link: link,
templateUrl: 'scripts/widgets/templates/ccTags.html'
};
return directive;
function link($scope, element, attrs, controller) {
var a=[];
$scope.pushInArr= pushInArr;
function pushInArr (el){
if(a.indexOf(el)<0){
a.push(el);
$scope.filter = a.toString();
}
else{
a.splice(a.indexOf(el),1);
$scope.filter = a.toString();
}
}
}
}
})();
<label for="btn-group" ng-if="label">{{label}}</label>
<div class="row">
<div class="btn-group" id="btn-group">
<label class="btn btn-default" ng-repeat="c in dictionary" ng-click="pushInArr(c.id)"
ng-model="arr-m[c.id]" >
{{(c.name ? c.name : c)}}
</label>
</div>
</div>