root-app-folder Index── index.html Scrip── scripts │ ├── controllers │ │ └── main.js │ │ └── ... │ ├── directives │ │ └── myDirective.js │ │ └── ... │ ├─ filters │ │ └── myFilter.js │ │ └── ... │ ├── services │ │ └── myService.js │ │ └── ... │ ├── vendor │ │ ├── angular.js │ │ ├── angular.min.js │ │ ├── es5-shim.min.js │ │ └── json3.min.js │ └── app.js ├── styles │ └── ... Views── views Main── main.html └── ...
models
directory inside services
. As a rule, I also sort files by directories, if there is some rational hierarchy with which you can organize file storage., , .
app.js :
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js :
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js :
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
, , .
app.js
:
angular.module('yourAppName', ['yourAppDep']); angular.module('yourAppDep');
, .. :
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
( ) , . Google+ . , , , , .
, , , . , , . , /. , , , , .
, , , .., . , . .
API- . .
. . , ngmodules , .
, «The Best Todo List App Ever», «btla».
angular.module('yourAppDep').directive('btlaControlPanel', function () { // ... });
, , , . GZIP- - .
angular.module('yourAppDep').service('MyCtrl', function () { // ... });
- , . , , , . , .
NoSQL , CouchDB MongoDB, JavaScript- (POJO) . , MySQL, - , . RESTful-, $resource . , , . , . .
, Underscore.js , , Backbone.js.
, "Ctrl".
angular.module('yourAppDep').controller('MyCtrl', function () { // ... });
, . , . , , , , . .
, , . , , . . -, . Batarang .
(digest)
«». StackOverflow .
. , -, , . , 30 .
app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function () { // var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }); } // ... }; });
, «» , . Underscore.js , , socket
:
app.factory('socket', function ($rootScope) { // Underscore.js 1.4.3 // http://underscorejs.org // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. // _.throttle // https://github.com/documentcloud/underscore/blob/master/underscore.js#L626 // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. var throttle = function (func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date(); timeout = null; result = func.apply(context, args); }; return function() { var now = new Date(); var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, throttle(function () { // 500 var args = arguments; $rootScope.$apply(function () { callback.apply(socket, args); }); }, 500)); } // ... }; });
, . $scope.$digest $scope.$apply
. $digest
, .
, , $scope.$watch . , . , , .
, , . , , .
, , , . , $filter .
, , , :
{{someModel.name | titlecase}}
.
angular.module('myApp').controller('MyCtrl', function ($scope, $http, $filter) { $http.get('/someModel') .success(function (data) { $scope.someModel = data; // «titlecase» $scope.someModel.name = $filter('titlecase')($scope.someModel.name); }); });
, , . JavaScript , . , Underscore.js , . , . . , , .
, (. )
. , . , (E2E) . , — , . , , . .
, . , , . . , .
Yeoman , , . .
Batarang , .
, , . . Node.js Nginx . Nginx , Node.js RESTful API / . Node.js . , -, .
, Nodejitsu Linode . Nodejitsu , Node.js. , . Node.js, . , Linode . Linode API . , .
, .
, , , , 2013 . ngmin , , , , , AngularJS .
, , - app.js
, ngmin
, , , Closure Compiler --compilation_level SIMPLE_OPTIMIZATIONS
. angular.js .
RequireJS . , , , , RequireJS .
- . , . , , .
-? , , - .
Source: https://habr.com/ru/post/182556/
All Articles