I do not see a question to answer, so I assume that your question is looking for information about your idea.
Getting work with Angular can be very different from how you usually work, mainly because of their full and full use of dependency injection.
You do not need to "tell" Angular anything; you must have access to all this information through a nested dependency, the Angular service.
Using what you showed me, it might look something like this:
my.MediaInfo = function($window) { this.window_ = $window; this.inIframe = $window.self !== $window.top; if(!this.inIFrame) { this.width = $window.innerWidth; this.height = $window.innerHeight; } else { this.width = this.height = ...; } } my.angular.controller = function($scope, mediaInfo) {
Then your Angular module will look like this:
angular.module('module', []) .service('mediaInfo', my.MediaInfo) .controller('mainCtrl', my.angular.controller);
Hope this is a good demonstration of how you should receive data in Angular.
source share