This is a migrated thread and some comments may be shown as answers.

Angular, ControllerAs not working

1 Answer 92 Views
Notification
This is a migrated thread and some comments may be shown as answers.
Alistair
Top achievements
Rank 1
Alistair asked on 05 Sep 2014, 03:36 PM
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?





1 Answer, 1 is accepted

Sort by
0
Mihai
Telerik team
answered on 09 Sep 2014, 08:57 AM
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!
 
Tags
Notification
Asked by
Alistair
Top achievements
Rank 1
Answers by
Mihai
Telerik team
Share this question
or