AngularJSでogroooomnyhアプリケーションを作成する

Angularドキュメンテーションは、APIの開始と選択に最適です。 ただし、数万行または数十万行のコードに成長した場合のアプリケーションの編成および管理方法については説明していません。 ここでは、スプロールするアプリケーションを管理するためのいくつかの観察とベストプラクティスを集めました。 まず、組織を見てから、パフォーマンスを改善するためのヒントに進み、最後にツール、サーバー、ビルドプロセスの簡単な概要を説明します。 この投稿では、大規模なアプリケーションに焦点を当てます。特に、12月の会議のAngularJSベストプラクティスに関する優れた記事があります。これも一見の価値があります。

巨大なアプリケーションを書かないでください


巨大なアプリケーションに関する最善のアドバイスは、それらを実行しないことです。 小さく焦点を絞ったモジュラーパーツを記述し、それらを徐々に大きなものに組み合わせて、アプリケーションを組み立てます。 (このヒントは、node.jsハッカーから提供されたものです。あらゆる点で、クールな@substackのです 。)

組織


おそらく、大規模なアプリケーションの最大の問題は、すべてのコードをどこに置くかです。 組織を必要とするものには、ファイル、ディレクトリ、モジュール、サービス、コントローラーが含まれます。 優れたプロジェクト構造の概要については、 GithubのAngularJSテンプレートプロジェクトをご覧ください 。 それでも、プロジェクトの構造についてさらに掘り下げて、いくつかの追加の推奨事項を提供したいと思います。 ディレクトリから始めて、リストを下に移動しましょう。

カタログ

私が推奨する典型的なフォルダ構造:

ルートアプリフォルダー
 ├──index.html
 ├──スクリプト
 │├──コントローラー
 ││└──main.js
 ││└──...
 │├──ディレクティブ
 ││└──myDirective.js
 ││└──...
 │├──フィルター
 ││└──myFilter.js
 ││└──...
 │├──サービス
 ││└──myService.js
 ││└──...
 │├──ベンダー
 ││├──angular.js
 ││├──angular.min.js
 ││├──es5-shim.min.js
 ││└──json3.min.js
 │└──app.js
 ├──スタイル
 │└──...
 └──ビュー
     ├──main.html
     └──...

新しいファイルを追加するときに、コントローラとサービスをさらに編成するためのサブディレクトリを作成することは理にかなっています。 たとえば、私はよく自分でservices内でmodelsディレクトリを使用していることに気付きservices 。 原則として、ファイルストレージを整理できる合理的な階層がある場合、ファイルをディレクトリにソートします。

コード編成のトピックで、同じ方法を読んでください。 大規模なAngularJSおよびJavaScriptアプリケーションでのコードの編成(コメント翻訳者)

ファイル

各ファイルには1つの「エンティティ」が含まれている必要があります。「エンティティ」は、コントローラー、ディレクティブ、フィルター、またはサービスです。 これにより、少なくともファイルにフォーカスすることができます。 また、APIテスト用のリトマステストの作成にも役立ちます。 ファイルを頻繁に入れ替える場合は、APIが複雑すぎることを示しています。 それらを再考、再編成、簡素化する必要があります。

密接に関連する指令については例外を作りたいと思います。 たとえば、 , , .


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 .


- . , . , , .

-? , , - .

, , .


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/J182556/


All Articles