ghiscoding / Aurelia-Bootstrap-Plugins

Aurelia-Bootstrap-Plugins are Custom Elements to bridge with a set of 3rd party Bootstrap addons
https://ghiscoding.github.io/Aurelia-Bootstrap-Plugins
MIT License
45 stars 23 forks source link

Method refresh not working #19

Closed nvtin closed 6 years ago

nvtin commented 7 years ago

I am using this plugin. In view I call <abp-tags-input element.bind="tag" value.bind="keywords"></abp-tags-input> And in viewModel I have this.keywords = ['word1', 'word2'] actually I add @bindable tag; It display tags so great when the first time I go to page. but after I did a change the keywords like: this.keywords = ['other-value'] and call this.tag.methods.refresh(); But nothing change from input tag even the value for input is updated. checked by: $('abp-tags-input input.form-control.au-target').val() => other-value but the tags UI does not update. On browser console, I try to call $('abp-tags-input input.form-control.au-target').tagsinput('refresh') but it's not work anymore. What thing I am doing wrong or is it a bug?

Thanks!

ghiscoding commented 7 years ago

Thanks for reporting the issue, I might not have tested it the way you tried. So I can't say for sure if it's an issue or not. However if you try doing like in the client samples that I provided. You can do it this way, multiple steps.

this.tag.methods.removeAll();
this.tag.methods.add('other-value');

oh wait, having another look at my plugin code and I can see that I didn't implement a valueChanged, so yeah I can understand why it doesn't work. I'll have to look at implementing it eventually, I'll see if I can do that in the coming week or so, in the mean time you can use the code I posted just on top.

ghiscoding commented 7 years ago

Looked at this issue and I see that if you want to use an array of strings, you should use the multiple as shown in the 2nd example on Bootstrap-tagsinput

True multi value Use a