Integration with Angular JS

4 posts, 1 answers
  1. Jean
    Jean avatar
    2 posts
    Member since:
    Jun 2014

    Posted 19 Aug 2014 Link to this post

    Hi,

    I'm trying to bind a MultiSelect with Angular JS using k-ng-model. It seems to work when I select elements, but not when displaying the control (nothing is pre-selected).

    Code from Angular controller:
    $scope.selectOptions = {
            placeholder: "Select roles...",
            dataTextField: "roleName",
            autoBind: false,
            dataSource: $scope.roles,
             
    select: function(e) {
    console.log("Event: "+e.item);
    }
        };


    HTML:
    <div data-kendo-multi-select
    data-k-options="selectOptions"
    data-k-ng-model="user.roles"
    style="width: 300px">


  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 20 Aug 2014 Link to this post

    Hello,

    Did you have a chance to look at this online demo? It shows pre-selected items in multiselect with autoBind: false. If your scenario differs from the online demo, could you please create a Kendo Dojo demo reproducing the issue? This will help us to observe the problem locally and advice you further.

    Regards,
    Georgi Krustev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Jean
    Jean avatar
    2 posts
    Member since:
    Jun 2014

    Posted 20 Aug 2014 in reply to Georgi Krustev Link to this post

    Hi Georgi,

    I was able to reproduce my issue at http://dojo.telerik.com/ufEl/2

    It seems to work fine with primitive values, but not with object. As you can see nothing is pre-selected, however selecting roles work.

    Thanks for your help,

    Jean
  5. Answer
    Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 21 Aug 2014 Link to this post

    Hello Jean,

    Thank you for the repro demo. Currently, setting array of objects directly to the widget is not supported. Basically, the value of the k-ng-model is directly passed to the value method of the widget, which accepts only an array of primitive values. We will further consider how this scenario should be supported.
    For now you will need to use primitive values only.

    Regards,
    Georgi Krustev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready