I am trying to update the state of my controller after loading of a script from onload callback.
I load the Google Client API:
<script src="https://apis.google.com/js/client.js?onload=OnLoadCallback"></script>
Then in OnLoadCallback I try to manually bootstrap AngularJS and set the set state on to my controller:
function OnLoadCallback() {
var $injector = angular.bootstrap(document, ['app']);
// load required gapi APIs
var $controller = $injector.get('$controller');
var UserCtrl = $controller('UserCtrl');
UserCtrl.user.apiLoaded = true;
};
It cannot seem to create a controller with the $scope injected. As the call $controller('UserCtrl')
fails with:
Uncaught Error: Unknown provider: $scopeProvider <- $scope
You can see the error by viewing the console in this Plunk.