Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Plain Text by Shiv ( 12 years ago )
function GloBalData()
        {
            return { sharedObject: { Data: "dd" } }
        }

        function SomeClass($scope, GloBalData)
        {
            $scope.myData = { "val": "value1" };
            $scope.Global = GloBalData;
        }
        var app = angular.module("myApp", []); // creating a APP
        app.factory("GloBalData", GloBalData);
        var ctr = app.controller('SomeClass', SomeClass); // Registering the VM

 <div ng-c>
        <input id="Text1" type="text" ng-model="myData.val" />
        {{myData.val}}<br />
        <input id="Text1" type="text" ng-model="Global.Data" />
    </div><br />
     <div ng-c>
        <input id="Text1" type="text" ng-model="myData.val" />
        {{myData.val}}<br /><br />
        <input id="Text1" type="text" ng-model="Global.Data" />
    </div>

 

Revise this Paste

Parent: 76577
Your Name: Code Language: