Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $scope.SaveDB(iObj,function(iResult){
- //after a sucessfull opreation in the DB. Now I need iObj to pass to other controller.
- // I have used $emit method
- $rootScope.$emit('saveCallback');
- })
- var _save = $rootScope.$on('saveCallback',function(){
- //i want same obj(which is used for saving ) to be access here.
- })
- $scope.SaveDB(iObj,function(iResult){
- $scope.$emit('saveCallback',iResult); //pass the data as the second parameter
- });
- $scope.$on('saveCallback',function(event,iResult){//receive the data as second parameter
- });
- $scope.SaveDB(iObj,function(iResult){
- $scope.$emit('saveCallback',iResult);
- });
- $scope.$on('saveCallback',function (event,iresult){
- $scope.$broadcast('saveCallback',iresult);
- });
- $scope.SaveDB(iObj,function(iResult){
- $rootScope.$broadcast('saveCallback',iResult);
- });
- $scope.$on('saveCallBack',function(event, data) {
- //access data here
- });
- $rootScope.$broadcast('saveCallback',iresult);
- $scope.$on('saveCallBack',function(event, data) {
- //access data here
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement