ng:include onload not working

4,083 views
Skip to first unread message

ruedaminute

unread,
Feb 6, 2012, 3:47:45 PM2/6/12
to AngularJS
Hi there,

I'm trying like some other threads I've seen here to execute some code
after content from a partial has been loaded. I'm using the following:

<ng:include src="$service('$route').current.template"
scope="$service('$route').current.scope" onload="alert('hello!');"></
ng:include>

However, the alert('hello'); does not run. Any ideas as to why?

Thanks, really liking Angular so far!

Michelle

Vojta Jina

unread,
Feb 6, 2012, 10:42:27 PM2/6/12
to ang...@googlegroups.com
You have to define alert method on your controller...
When the expression is evaluated, it has no access to global context.

V.

ruedaminute

unread,
Feb 7, 2012, 10:33:49 AM2/7/12
to AngularJS
Thanks so much, that did the trick :)
Reply all
Reply to author
Forward
0 new messages