So, I have two applications with one page, these two applications contain a list of elements, in Application Awe have List A, and in Application Bwe have List B.
an element in List Acan be a parent for elements in List B, from one to many relationships.
If the user clicks the item in App A, he gets the opportunity view related items, it will open App Bin a separate window (new tab) and filters List Bto display only related items by clicking the item in App A.
This means that I have to open a new window and run the function when this window is ready, and pass the IDclicked item to filter my list.
$scope.openNewWindow = function(id){
var popup = window.open('newPageUrl');
var readyStateCheckInterval = setInterval(function() {
if (popup.document.readyState === "complete") {
clearInterval(readyStateCheckInterval);
popup.functionToRunWhenReady(id);
}
}, 50);
};
functionToRunWhenReady() javascript , $scope, , $scope
function functionToRunWhenReady(id) {
angular.element(document).ready(function () {
var scope = angular.element($('#myAppDiv')).scope();
scope.$apply(function() {
scope.setFilter(id);
});
});
}
, , document, scope, var scope = angular.element($('#myAppDiv')).scope();, setFilter(id)
, , .
tl; dr , $scope , ?
: , $routeparams, , ( ),