angular-selectize icon indicating copy to clipboard operation
angular-selectize copied to clipboard

Way to add values to the config

Open Nesse opened this issue 10 years ago • 0 comments

Hi,

I want to use your directive in a repeat. But in that repeat I use different entities and model that I need to alter or update. This is the error I'm getting:

Error: [$rootScope:infdig] http://errors.angularjs.org/1.4.7/$rootScope/infdig?p0=10&p1=%5B%5B%7B%22ms…ld%22%3A%22Name%22%2C%22plugins%22%3A%5B%22remove_button%22%5D%7D%7D%5D%5D
<div ng-repeat="productContainer in vm.productContainers">
     <selectize placeholder="Pick a Color ..." options="vm.colorLookups" config="vm.selectedColorsConfig(productContainer.entity, productContainer.model)" ng-model="productContainer.model.selectedColorIds" required="true"></selectize>
</div>

vm.selectedColorsConfig = function (entity, model) {

    return {
        searchField: ["Name"],
        labelField: "Name",
        valueField: "Id",
        sortField: "Name",
        plugins: ["remove_button"],
        onChange: function(value) {
            // do something with the entity and model
            alert(value);
        }
    };
};

Nesse avatar Nov 19 '15 16:11 Nesse