javascript

Passing data within your controllers

/**
 * Created by nmeegama on 8/27/16.
 */
/************ Controller to set the data *******************/
(function (angular) {

    'use strict';
    angular.module('MyApp').controller('SetDataCtrl', [
        '$scope', 'MyService',
        function ($scope, MyService) {

            $scope.setData = function (data) {
                MyService.setData(data);
            };

        }]);
})(angular);

/************ Controller to get the data *******************/
(function (angular) {

    'use strict';
    angular.module('MyApp').controller('GetDataCtrl', [
        '$scope',