Angular, ControllerAs not working

2 posts, 0 answers
  1. Alistair
    Alistair avatar
    8 posts
    Member since:
    May 2014

    Posted 05 Sep 2014 Link to this post

    I have an angular template with the following notification:

    <div kendo-notification="saveNotification">
    </div>

    In the controller when the save button is clicked I have:

    $scope.saveNotification.show("Hello", "World");

    which works.  However, when I try and access the control via the ControllerAs syntax:

    var vm = this;
    vm.saveNotification.show();

    I get the error "Cannot read property "show" of undefined".

    Can you tell me what I am doing wrong?





  2. Mihai
    Admin
    Mihai avatar
    153 posts

    Posted 09 Sep 2014 Link to this post

    Hi,

    The widget references are only exposed to the scope, so in order for that variable to get into your controller object you'll have to name it "main.notification".  Example: http://dojo.telerik.com/OPOR/2

    Regards,
    Mihai
    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
Back to Top