Skip to content

Instantly share code, notes, and snippets.

@matmkian
Created August 30, 2016 15:19
Show Gist options
  • Save matmkian/e7fd7786bf5323d20fc0e525c997c8bc to your computer and use it in GitHub Desktop.
Save matmkian/e7fd7786bf5323d20fc0e525c997c8bc to your computer and use it in GitHub Desktop.
(function()
{
'use strict';
angular
.module('Controllers')
.controller('MyController', MyController);
/* @ngInject */
function MyController($scope, MyService)
{
var vm = this;
// Private members
var _privateMember = 'example';
// Public members
vm.publicMember = 'example';
// Public methods
vm.publicMethod = publicMethod;
// Public services
vm.MyService = MyService;
// Watchers
$scope.$watch('value', _privateMethod);
// Init controller
_init();
////////////////////////////////////
/**
* Method description
* @private
*/
function _init()
{
// Nothing to do
}
/**
* Method description
* @private
* @param {object} newValue
* @param {object} oldValue
*/
function _privateMethod(newValue, oldValue)
{
// Nothing to do
}
////////////////////////////////////
/**
* Method description
* @param {string} param
* @return {string}
*/
function publicMethod(param)
{
_privateMember = param;
return _privateMember;
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment