Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #200

Open
wants to merge 166 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
166 commits
Select commit Hold shift + click to select a range
9570c2b
Create Gruntfile.js for Grunt
Jan 6, 2014
5caec74
Hello, World!
Jan 6, 2014
97ee132
Enable Static Analysis With JSHint
Jan 6, 2014
d7ac882
Have Git ignore node_modules
Jan 6, 2014
26f1beb
Enable Unit Testing With Jasmine And Testem
Jan 6, 2014
4bbab7c
Include Lo-Dash And jQuery
Jan 6, 2014
315916e
Define The Default Grunt Task
Jan 6, 2014
97c2de4
Removed placeholder Hello, World code
Jan 6, 2014
b2ef4b1
Scope Objects
Jan 6, 2014
c048528
Watching Object Properties: $watch And $digest
Jan 6, 2014
6bbde64
Checking for Dirty Values
Jan 6, 2014
8072fed
Initializing Watch Values
teropa Feb 25, 2014
0cc70c1
Getting Notified Of Digests
Jan 6, 2014
6add1d5
Giving Up On An Unstable Digest
Jan 6, 2014
dbc93fc
Short-Circuit The Digest When The Last Watch Is Clean
Jan 7, 2014
08c41c3
Value-Based Dirty-Checking
Jan 6, 2014
33df168
NaNs
Jan 6, 2014
9186cda
$eval - Evaluating Code In The Context of A Scope
Jan 6, 2014
73bba1b
$apply - Integrating External Code With The Digest Cycle
Jan 6, 2014
aebd1f4
$evalAsync - Deferred Execution
Jan 6, 2014
7a6cf6e
Scheduling $evalAsync from Watch Functions
teropa Feb 22, 2014
45948be
Scope Phases
Jan 6, 2014
0367f5d
Coalescing $apply Invocations - $applyAsync
teropa Oct 19, 2014
e3ea7b9
Running Code After A Digest - $$postDigest
Jan 6, 2014
9cdcc25
Handling Exceptions
Jan 6, 2014
80ffb40
Watching Several Changes With One Listener:
teropa Sep 21, 2014
25c6536
Making A Child Scope
Jan 6, 2014
41658e6
Attribute Shadowing
Jan 6, 2014
f313c91
Digesting The Whole Tree from $apply, $evalAsync, and $applyAsync
Jan 6, 2014
a573420
Substituting The Parent Scope
teropa Nov 15, 2014
656de5f
Destroying Scopes
Jan 6, 2014
f76cb8f
Update CONTRIBUTING.md
Foxandxss Jan 12, 2014
351cfb8
Update README, fix contributing url.
Foxandxss Jan 10, 2014
f9900a3
Setting Up The Infrastructure for Watching Collections
Jan 18, 2014
b2a0c95
Detecting Non-Collection Changes
Jan 18, 2014
36c29ce
Handling NaNs in $watchCollection
teropa Mar 29, 2014
d11cbc2
Detecting New Arrays
Jan 18, 2014
ea493c3
Detecting New Or Removed Items in Arrays
Jan 18, 2014
de5e7d6
Detecting Replaced or Reordered Items in Arrays
Jan 18, 2014
c10f093
Array-Like Objects
Jan 18, 2014
5c99d13
Detecting New Objects
Jan 18, 2014
44dd315
Detecting New Or Replaced Attributes In Objects
Jan 18, 2014
3bfa2b1
Detecting Removed Attributes In Objects
Jan 18, 2014
e88e6c6
Preventing Unnecessary Object Iteration
Jan 18, 2014
7c608ee
Dealing with Objects that Have A length
Jan 18, 2014
a4a4311
Handing The Old Collection Value To Listeners
teropa Mar 29, 2014
33889bc
Events: Test Setup
Feb 1, 2014
f15b94a
Registering Event Listeners: $on
Feb 1, 2014
d66a5f8
The basics if $emit and $broadcast
Feb 1, 2014
8634844
Dealing with Duplication
Feb 1, 2014
73b9365
Event Objects
Feb 1, 2014
0ca42c8
Additional Listener Arguments
Feb 1, 2014
3b2db59
Returning The Event Object
Feb 1, 2014
f16f121
Deregistering Event Listeners
Feb 1, 2014
d714989
Emitting Up The Scope Hierarchy
Feb 1, 2014
5a3a239
Broadcasting Down The Scope Hierarchy
Feb 1, 2014
03d5d98
Including The Current And Target Scopes in The Event Object
Feb 1, 2014
4134394
Stopping Event Propagation
Feb 1, 2014
0d406f3
Preventing Default Event Behavior
Feb 1, 2014
d7b8285
Broadcasting Scope Removal
Feb 1, 2014
70fd3f7
Handling Event Listener Exceptions
Feb 1, 2014
9eb02ca
Parsing setup
teropa Mar 11, 2014
fcf9ebb
Parsing Integers
teropa Mar 11, 2014
72fbd22
Marking Literals And Constants
teropa Mar 11, 2014
2e0d071
Parsing Floating Point Numbers
teropa Mar 11, 2014
a80da49
Parsing Scientific Notation
teropa Mar 11, 2014
4d79178
Parsing Strings
teropa Mar 11, 2014
df4b447
Parsing true, false, and null
teropa Mar 11, 2014
4766428
Parsing Whitespace
teropa Mar 11, 2014
5ae46a5
Parsing Arrays
teropa Mar 30, 2014
00e13e0
Parsing Objects
teropa Mar 30, 2014
7176826
Simple Attribute Lookup
teropa Mar 23, 2014
075b057
Nested Attribute Lookup
teropa Mar 23, 2014
f9a063c
Arbitrarily Nested Attribute Lookup
teropa Mar 25, 2014
dd81513
Getter Caching
teropa Mar 25, 2014
893d0df
Locals
teropa Mar 25, 2014
1dde5e2
Square Bracket Property Access
teropa Mar 27, 2014
9e3e188
Field Access
teropa Mar 27, 2014
fe3157e
Function Calls
teropa Mar 28, 2014
f4d6ae3
Function Calls
teropa Mar 28, 2014
212d5b0
Ensuring Safe Objects
teropa Mar 28, 2014
426a4b2
Ensuring Safe Functions
teropa Aug 6, 2014
3bc3ba9
Assigning Values
teropa Mar 28, 2014
41d3b11
Objects and Array Revisited
teropa Mar 31, 2014
458bb58
Unary Operators
teropa Apr 12, 2014
243871a
Multiplicative Operators
teropa Apr 12, 2014
551f22a
Relational and Equality Operators
teropa Apr 12, 2014
86e214b
Logical Operators
teropa Apr 12, 2014
112250f
The Ternary Operator
teropa Apr 12, 2014
4c5eedf
Altering The Precedence Order with Parentheses
teropa Apr 12, 2014
decf4ff
Statements
teropa Apr 12, 2014
5251ae3
Integrating Expressions to Scopes
teropa Oct 12, 2014
c62ed83
Optimizing Constant Expression Watching
teropa Oct 12, 2014
cc90648
One-Time Expressions
teropa Oct 12, 2014
2b82e03
Input Tracking
teropa Oct 12, 2014
f8e5b02
The angular Global
teropa May 18, 2014
dfb53fd
Initializing The Global Just Once
teropa May 18, 2014
a03f181
The module Method
teropa May 18, 2014
14cdfd2
Registering A Module
teropa May 18, 2014
b4b201b
Getting A Registered Module
teropa May 18, 2014
2e8d744
The Injector
teropa May 18, 2014
9a08564
Registering A Constant
teropa May 18, 2014
686d957
Requiring Other Modules
teropa May 18, 2014
52c4021
Dependency Injection
teropa May 18, 2014
8460bb8
Rejecting Non-String DI Tokens
teropa May 18, 2014
8f90d30
Binding this In Injected Functions
teropa May 18, 2014
39fe256
Providing Locals to Injected Functions
teropa May 18, 2014
df49dc9
Array-style Dependency Annotation
teropa May 18, 2014
4dcd1dc
Dependency Annotation from Function Arguments
teropa May 18, 2014
2d67db2
Strict Mode
teropa Nov 15, 2014
3912989
Integrating Annotation with Invocation
teropa May 18, 2014
f6a1d0e
Instantiating Objects with Dependency Injection
teropa May 24, 2014
86566b8
The Simplest Possible Provider: An Object with A $get Method
teropa May 20, 2014
13c6722
Injecting Dependencies to The $get Method
teropa May 21, 2014
0634877
Lazy Instantiation of Dependencies
teropa May 21, 2014
d34e56d
Singleton Enforcement
teropa May 22, 2014
26b36b6
Circular Dependencies
teropa May 22, 2014
3c27727
Provider Constructors
teropa May 24, 2014
4e41508
Two Injectors: The Provider Injector and The Instance Injector
teropa May 24, 2014
6a509a6
Unshifting Constants in The Invoke Queue
teropa May 24, 2014
39f3487
Injecting The $injectors
teropa May 27, 2014
426993e
Injecting $provide
teropa May 27, 2014
bcd1ceb
Config Blocks
teropa May 28, 2014
bfc950e
Run Blocks
teropa May 29, 2014
3b19077
Function Modules
teropa Jun 10, 2014
a5f1171
Factories
teropa Jun 10, 2014
76136e1
Values
teropa Jun 10, 2014
91d8dc9
Services
teropa Jun 10, 2014
f460f2a
Decorators
teropa Jun 11, 2014
2be97ff
Integrating Scopes And Expressions with The Injector
teropa Jun 13, 2014
46e0e94
Making a Configurable Provider: Digest TTL
teropa Jun 13, 2014
a256744
Creating The $compile Provider
teropa Aug 2, 2014
c90cfae
Registering Directives
teropa Aug 2, 2014
5b7c32a
Compiling The DOM with Element Directives
teropa Aug 2, 2014
70fb33a
Recursing to Child Elements
teropa Aug 3, 2014
04d6f07
Using Prefixes with Element Directives
teropa Aug 3, 2014
1004bcc
Applying Directives to Attributes
teropa Aug 3, 2014
2841453
Applying Directives to Classes
teropa Aug 3, 2014
374f972
Applying Directives to Comments
teropa Aug 3, 2014
a0fcd74
Restricting Directive Application
teropa Aug 3, 2014
bfe273a
Applying Directives Across Multiple Nodes
teropa Aug 3, 2014
2e2dd44
added MIT license to the code
teropa Aug 9, 2014
cf1b6ab
Passing Attributes to the compile Function
teropa Aug 12, 2014
2128a31
Handling Boolean Attributes
teropa Aug 12, 2014
f40851e
Overriding attributes with ng-attr
teropa Nov 16, 2014
3c63830
Setting Attributes
teropa Aug 13, 2014
c914b00
Setting Boolean Properties
teropa Aug 13, 2014
627a16a
Denormalizing Attribute Names for The DOM
teropa Aug 14, 2014
70a5eba
Observing Attributes
teropa Aug 15, 2014
5c3ac94
Adding Class Directives As Attributes
teropa Aug 16, 2014
201b34b
Adding Comment Directives As Attributes
teropa Aug 16, 2014
a22aeb9
Manipulating Classes
teropa Aug 16, 2014
0d2d85b
ignore .DS_Store
teropa Oct 12, 2014
fdf037e
The Public Link Function
teropa Dec 9, 2014
341ecdd
Directive Link Functions
teropa Dec 9, 2014
80da3f7
Plain Directive Link Functions
teropa Dec 9, 2014
379fb0a
Linking Child Nodes
teropa Dec 10, 2014
09d8f4d
Pre- and Post-Linking
teropa Dec 10, 2014
dbb6455
Keeping The Node List Stable for Linking
teropa Dec 11, 2014
1c28019
Linking Directives Across Multiple Nodes
teropa Dec 11, 2014
0b7bc56
Linking And Scope Inheritance
teropa Dec 15, 2014
7a6430b
Isolate Scopes
teropa Dec 16, 2014
e91580e
Isolate Attribute Bindings
teropa Dec 17, 2014
9091390
Two-Way Data Binding
teropa Dec 22, 2014
ff935c2
Expression Binding
teropa Dec 22, 2014
114e838
Update README.md
yaroslavya Dec 29, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
.DS_Store
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ If you find a bug, typo, or some other kind of issue in the book content or in t
it if you reported it to the [Issues](https://github.com/teropa/build-your-own-angularjs/issues) section of this
repository.

When reporting an issue, please use the following conventions:
When reporting an issue, please use the following convention:

* Prefix the issue title with the corresponding page number (e.g. "P45")
* Assign a chapter label to the issue (one of "chapter1", "chapter2", etc.)

Your feedback is much appreciated!
52 changes: 52 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
module.exports = function(grunt) {

grunt.initConfig({
jshint: {
all: ['src/**/*.js', 'test/**/*.js'],
options: {
globals: {
_: false,
$: false,
jasmine: false,
describe: false,
it: false,
expect: false,
beforeEach: false
},
browser: true,
devel: true
}
},
testem: {
unit: {
options: {
framework: 'jasmine2',
launch_in_dev: ['PhantomJS'],
before_tests: 'grunt jshint',
serve_files: [
'node_modules/lodash/lodash.js',
'node_modules/jquery/dist/jquery.js',
'src/**/*.js',
'test/**/*.js'
],
watch_files: [
'src/**/*.js',
'test/**/*.js'
]
}
}
},
watch: {
all: {
files: ['src/**/*.js', 'test/**/*.js'],
tasks: ['jshint']
}
}
});

grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-testem');
grunt.loadNpmTasks('grunt-contrib-watch');

grunt.registerTask('default', ['testem:run:unit']);
};
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License

Copyright (c) 2010-2014 Tero Parviainen
Based on AngularJS, Copyright (c) 2010-2014 Google, Inc. http://angularjs.org

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ There is also a tag for each chapter, pointing to the state of the codebase at t

## Errata

The [Issues](https://github.com/teropa/build-your-own-angularjs/issues) setion of this repository contains the book's errata.
The [Issues](https://github.com/teropa/build-your-own-angularjs/issues) section of this repository contains the book's errata.

If you find bugs, typos, mistakes, or other issues that should be improved, I would love to hear about it. See [CONTRIBUTING.md](CONTRIBUTING.MD).
If you find bugs, typos, mistakes, or other issues that should be improved, I would love to hear about it. See [CONTRIBUTING.md](CONTRIBUTING.md).

11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
{
"name": "my-own-angularjs",
"version": "0.1.0"
"version": "0.1.0",
"devDependencies": {
"grunt-contrib-jshint": "~0.8.0",
"grunt-contrib-testem": "^0.5.16",
"grunt-contrib-jasmine": "~0.6.0"
},
"dependencies": {
"lodash": "~2.4.1",
"jquery": "~2.1.0-beta3"
}
}
25 changes: 25 additions & 0 deletions src/Angular.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* jshint globalstrict: true */
'use strict';

_.mixin({
isArrayLike: function(obj) {
if (_.isNull(obj) || _.isUndefined(obj)) {
return false;
}
var length = obj.length;
return length === 0 ||
(_.isNumber(length) && length > 0 && (length - 1) in obj);
},
camelCase: function(name) {
return name.replace(/([\:\-\_]+(.))/g, function(match, separator, letter, offset) {
return offset > 0 ? letter.toUpperCase() : letter;
});
},
snakeCase: function(name, separator) {
var SNAKE_CASE_REGEXP = /[A-Z]/g;
separator = separator || '_';
return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {
return (pos ? separator : '') + letter.toLowerCase();
});
}
});
10 changes: 10 additions & 0 deletions src/angular_public.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function publishExternalAPI() {
'use strict';

setupModuleLoader(window);

var ngModule = angular.module('ng', []);
ngModule.provider('$parse', $ParseProvider);
ngModule.provider('$rootScope', $RootScopeProvider);
ngModule.provider('$compile', $CompileProvider);
}
36 changes: 36 additions & 0 deletions src/apis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* jshint globalstrict: true */
'use strict';

function hashKey(value) {
var type = typeof value;
var uid;
if (type === 'function' || (type === 'object' && value !== null)) {
uid = value.$$hashKey;
if (typeof uid === 'function') {
uid = value.$$hashKey();
} else if (uid === undefined) {
uid = value.$$hashKey = _.uniqueId();
}
} else {
uid = value;
}
return type + ':' + uid;
}

function HashMap() {
}

HashMap.prototype = {
put: function(key, value) {
this[hashKey(key)] = value;
},
get: function(key) {
return this[hashKey(key)];
},
remove: function(key) {
key = hashKey(key);
var value = this[key];
delete this[key];
return value;
}
};
Loading