In this simplified scenario, I have two files: index.htm, lazy.htm.
index.htm:
var myApp = angular.module(\'myApp\', []);
myApp.controller(\'embed\',
The best way to do what you are asking is to instead use a directive and tie the controller and template together that way so its bound at the appropriate time. Currently, the binding it not happening in lazy.htm at the right time unless you declare a global function as you've shown in your second example.