0

I have 2 pages in tabs,the page2 has a select input named OF in which I get the list of OF that I have modified from page1 ,the 2 pages charged together,so every modification for the OF list in page1 doesn't charge in page2, I tried to use a factory to do that but it doesn't solve my problem:

page1:

//create a new OF:

      $scope.creerOrdreFabrication = function(ordreF) {

       $http.post("URLToCreateOF",ordreF)
        .success(function(newOF) {

             //get the list of OFs to update it after create
           $scope.listeOrdreFabrication();

                     });      }

        $scope.listeOrdreFabrication = function() {
        $http.get("WebServicetoGetOFs")
         .success(
            function(dataOrdreFabrication) {
                $scope.myDataOF = dataOrdreFabrication;
        });}

page2:

the factory that I have created to share the List of OF after the creatation:

.factory('OfFactory',function($http, $q) {

        var backObject = {
            getListOF : _getListOF
        }
 function _getListOF() {

            var defer = $q.defer();
            $http({
                method: "GET",
                url: "WebServicetoGetOFs"
            }).then(function mySucces(response) {

                defer.resolve(response.data);
            }, function myError(response) {

            });

            return defer.promise; 
        };
})

//then I call this Factory in page2 like that in an initialisation function and use the OFListWS that contains the OF list 



var _init = function() {
      gammeOfFactory
         .getListOF()
            .then(function(BackData) {

               $scope.OFListWS= JSON.parse(JSON.stringify(BackData)); 
                                })
}

so,when I use this method,the list of OFs doesn't change in page2 after the create of new OF in page1 any help please is there any thing to use in angularJS that let to work in a synchronized way between page1 an page2 ??

thanks for help

user3821206
  • 609
  • 1
  • 8
  • 22
  • 1
    Do you mean two separate browser windows? There is no simple way to do that, except by routing data through a server or localStorage (as in http://stackoverflow.com/questions/2236828/javascript-communication-between-tabs-windows-with-same-origin/12514384) – Daniel Beck May 26 '16 at 17:57
  • no Sir page1 and page2 are two pages of sub menues – user3821206 May 26 '16 at 22:14

0 Answers0