I am using angular.js 1.2.13. I am using a third party tool which uses angular.js and to integrate within my project I am using angular.js code in my .js file.
To get scope data, I am using .scope() on HTML element. It is working fine in chrome and mozilla, but on IE 9, angular.element('#someId').scope() is returning undefined.
I have debugged and found that angular.element('#someId') is returning the expected element but .scope() on that is returning undefined.
On angular.js's website, it is written that 1.2.X is perfectly compatible with IE9. Why am I getting this error.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
//This code is written in external js file appConfig.js which is imported after angular.js
angular.module('modelerApp', []).run(['$rootScope', function($rootScope){
//This function is defined by me
$rootScope.bootstrap = function() {
//some logic needs to be executed here which should happen only after page load, so I am keeping it inside rootscope
}
}]);
<script type="text/javascript">
//This code is written in external js file which is getting imported in this page
$(document).ready(function(){
var scope = angular.element('#someId').scope(); //undefined
//I need scope to access rootscope of angular in order to execute logic inside bootstrap method
var rootScope = scope.$root;
//I want to execute logic written in bootstrap method, which is in $rootScope
//This logic uses angular js routes and all, and thus needs to be inside angular code.
//This has nothing to do with specific controller
rootScope.bootstrap();
});
</script>
<div ng-app="modelerApp" ng-controller="itemController">
<div id="main">
<div id="someId">
</div>
</div>
</div>
Any help is appreciated.