This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// private field init | |
var a = 1; | |
// Initialization logic is here | |
if () { | |
... | |
} | |
// Private functions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// private field init | |
var a = 1; | |
// public field init | |
$scope.b = 1; // For controllers | |
this.c = 1; // For services | |
// call init function | |
init(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.controller('DemoController', function ($scope, MyService) { | |
var _count = 0; | |
function _privateUtil() { // function decomposition | |
_count += _count + 1; | |
} | |
function _handleClick(data) { | |
_privateUtil(); | |
$scope.answer = MyService.doSomething({ |
NewerOlder