# Pastebin HtxROAxb angular.module('prioritizeApp').factory('mainService', [ function () { function ViewData() { this.sideBar = true; this.hideSideBar = function () { this.sideBar = false; }; this.showSideBar = function () { this.sideBar = true; }; } var viewData = new ViewData(); return { viewData: viewData }; }]); angular.module('prioritizeApp').factory('mainService', [ function () { return { viewData: new function () { this.sideBar = true; this.hideSideBar = function () { this.sideBar = false; }; this.showSideBar = function () { this.sideBar = true; }; } }; }]); angular.module('prioritizeApp').factory('mainService', [ function () { var viewData = {}; viewData.sideBar = true; viewData.hideSideBar = function () { viewData.sideBar = false; }; viewData.showSideBar = function () { viewData.sideBar = true; }; return { viewData: viewData }; }]); // if only need one instance angular.module('prioritizeApp').service('mainService', [ function ($http, $location, $window) { this.sideBar = true; this.hideSideBar = function () { this.sideBar = false; }; this.showSideBar = function () { this.sideBar = true; }; }]);