एपीआई में आरंभ करने और लेने के लिए कोणीय प्रलेखन महान है। हालाँकि, यह नहीं बताता है कि किसी अनुप्रयोग को व्यवस्थित और प्रबंधित कैसे करें जब यह दसियों या सैकड़ों हज़ारों लाइनों के लिए बढ़ता है। मैं अपनी कुछ टिप्पणियों के प्रबंधन के लिए यहां अपनी टिप्पणियों और सर्वोत्तम प्रथाओं को इकट्ठा किया है। सबसे पहले, संगठन पर एक नज़र डालें, फिर प्रदर्शन में सुधार के लिए कुछ युक्तियों पर आगे बढ़ें और टूल, सर्वर और निर्माण प्रक्रिया के संक्षिप्त सारांश के साथ समाप्त करें। यह पोस्ट बड़े अनुप्रयोगों पर ध्यान केंद्रित करेगी, विशेष रूप से, दिसंबर की बैठक से
एंगुलरजेएस सर्वोत्तम प्रथाओं पर एक उत्कृष्ट लेख है, जो एक नज़र के लायक भी है।
विशाल अनुप्रयोग न लिखें
विशाल अनुप्रयोगों पर सबसे अच्छी सलाह उन्हें नहीं करना है। छोटे, केंद्रित मॉड्यूलर भागों को लिखें और धीरे-धीरे आवेदन को इकट्ठा करने के लिए उन्हें बड़ी चीजों में मिलाएं। (यह टिप, नोड्स के हैकर द्वारा दिया गया था। हर तरह से,
कूल , ड्यूड
@ एसबस्टैक )।
संगठन
संभवतः बड़े अनुप्रयोगों के लिए सबसे बड़ा सवाल यह है कि सभी कोड कहां रखें। संगठन की आवश्यकता वाली चीजों के सेट में फ़ाइलें, निर्देशिकाएं, मॉड्यूल, सेवाएं और नियंत्रक शामिल हैं। अच्छी परियोजना संरचना के त्वरित अवलोकन के लिए,
Github पर AngularJS टेम्पलेट प्रोजेक्ट देखें । फिर भी, मैं परियोजना की संरचना पर कुछ गहरी सिफारिशें प्रस्तुत करना चाहता हूं। चलो निर्देशिकाओं के साथ शुरू करते हैं और सूची को नीचे ले जाते हैं।
कैटलॉग
विशिष्ट फ़ोल्डर संरचना जो मैं सुझाता हूं:
जड़-ऐप्लिकेशन-फ़ोल्डर
├── index.html
├── स्क्रिप्ट
Ers ers नियंत्रक
└── └── │ main.js
└── └── │ ...
Ives ives निर्देश
└── s │ myDirective.js
└── └── │ ...
├── ├── फिल्टर
└── s │ myFilter.js
└── └── │ ...
├── ├── सेवाएं
└──। │ myService.js
└── └── │ ...
├── ├── विक्रेता
├── ├── │ कोणीय.जेएस
├── s │ कोणीय.min.js
├── min │ es5-shim.min.js
└── j │ json3.min.js
।। App.js
├── शैलियों
│ │ ...
└── विचार
├── main.html
└── ...
जैसा कि आप नई फाइलें जोड़ते हैं, यह नियंत्रकों और सेवाओं के आगे संगठन के लिए उपनिर्देशिका बनाने के लिए समझ में आ सकता है। उदाहरण के लिए, मैं अक्सर खुद को
services
अंदर
models
निर्देशिका कर पाता हूं। एक नियम के रूप में, मैं फ़ाइलों को निर्देशिकाओं में भी सॉर्ट करता हूं, अगर कुछ तर्कसंगत पदानुक्रम है जिसके साथ आप फ़ाइल भंडारण को व्यवस्थित कर सकते हैं।
कोड संगठन के विषय पर,
बड़े AngularJS और जावास्क्रिप्ट अनुप्रयोगों में कोड का संगठन उसी तरह पढ़ें
(टिप्पणी अनुवादक)फ़ाइलें
प्रत्येक फ़ाइल में एक "एंटिटी" होनी चाहिए, जहाँ "एंटिटी" एक नियंत्रक, निर्देश, फ़िल्टर या सेवा हो। इससे आप कम से कम फ़ोकस फाइल कर सकते हैं। यह एपीआई परीक्षण के लिए लिटमस टेस्ट बनाने में भी मदद करता है। यदि आप अपने आप को बार-बार फाइलों को पलटते हुए पाते हैं, तो यह एक संकेत है कि आपके एपीआई बहुत जटिल हैं। उन्हें पुनर्व्यवस्थित, पुनर्गठित और सरल बनाना आवश्यक है।
मैं बारीकी से संबंधित निर्देशों के लिए एक अपवाद बनाना चाहूंगा। उदाहरण के लिए, यदि कोई निर्देश है
, , .
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
, , .
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
, , .
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
, , .
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
, , .
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
, , .
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
, , .
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
, , .
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
, , .
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
, , .
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 .
- . , . , , .
-? , , - .