Giter VIP home page Giter VIP logo

Comments (8)

lukasberlin avatar lukasberlin commented on August 24, 2024

Options that are passed via config are not bound to the scope of the directive and can thereby not be watched. Try passing the options via HTML attribute.

<selectize ng-model="person" options="people" config="myConfig" placeholder='Select a person...'></selectize>

from angular-selectize.

elgs avatar elgs commented on August 24, 2024

Passing the options via HTML attribute does not seem to work in my case. I load options from the server. The options are bound to $scope in an http callback. I have another list of items, in each item I need to show the selectize control. The user can also append new items to this list. What happened is that for the items loaded initially, the options are empty. However, for the items appended by user, the options are well populated. I have the feeling when the initial items are loaded, the options are still not arrived from the http callback yet. I tried to do $apply the options in the http callback, but it doesn't work.

from angular-selectize.

elgs avatar elgs commented on August 24, 2024

My problem was fixed by loading the list in the http callback in which options are loaded.

from angular-selectize.

mariowise avatar mariowise commented on August 24, 2024

I load the list on my service callback and options are not loaded. Can you provide some code to see the difference?

<selectize ng-model="newmessage.destinations" options="colabs" config="config"></selectize>

Service.asynCall()
.then(function (items) {
    $scope.colabs = items
})

from angular-selectize.

elgs avatar elgs commented on August 24, 2024

@mariowise I finally found my problem was the $scope. I have one selectize in each item in a list, and I'm updating the options from another scope which is far away. I end up updating the selectize using a lot of $scope.$parent.

from angular-selectize.

mariowise avatar mariowise commented on August 24, 2024

I think I misspoke. I have a similar problem to yours. And I can't solve it... my selectize stays with an [] (empty Array) and the options are not updated when my service (promise) resolves. Any ideas?

from angular-selectize.

elgs avatar elgs commented on August 24, 2024

@mariowise things get really complicated when the $scopes come to play. I end up solving my problem with the following code:

<selectize config="indexColumnConfig" options='$parent.tableColumns'
                                           data-ng-model="tableIndex.columnName"></selectize>

from angular-selectize.

mariowise avatar mariowise commented on August 24, 2024

oh right! was my mistake.. I was also passing the variable throw a $parent controller... now everything is working... Thanks!

from angular-selectize.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.