@angular-wave/angular.ts 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +1 -0
- package/.eslintrc.cjs +29 -0
- package/.github/workflows/playwright.yml +27 -0
- package/CHANGELOG.md +17974 -0
- package/CODE_OF_CONDUCT.md +3 -0
- package/CONTRIBUTING.md +246 -0
- package/DEVELOPERS.md +488 -0
- package/LICENSE +22 -0
- package/Makefile +31 -0
- package/README.md +115 -0
- package/RELEASE.md +98 -0
- package/SECURITY.md +16 -0
- package/TRIAGING.md +135 -0
- package/css/angular.css +22 -0
- package/dist/angular-ts.cjs.js +36843 -0
- package/dist/angular-ts.esm.js +36841 -0
- package/dist/angular-ts.umd.js +36848 -0
- package/dist/build/angular-animate.js +4272 -0
- package/dist/build/angular-aria.js +426 -0
- package/dist/build/angular-message-format.js +1072 -0
- package/dist/build/angular-messages.js +829 -0
- package/dist/build/angular-mocks.js +3757 -0
- package/dist/build/angular-parse-ext.js +1275 -0
- package/dist/build/angular-resource.js +911 -0
- package/dist/build/angular-route.js +1266 -0
- package/dist/build/angular-sanitize.js +891 -0
- package/dist/build/angular-touch.js +368 -0
- package/dist/build/angular.js +36600 -0
- package/e2e/unit.spec.ts +15 -0
- package/images/android-chrome-192x192.png +0 -0
- package/images/android-chrome-512x512.png +0 -0
- package/images/apple-touch-icon.png +0 -0
- package/images/favicon-16x16.png +0 -0
- package/images/favicon-32x32.png +0 -0
- package/images/favicon.ico +0 -0
- package/images/site.webmanifest +1 -0
- package/index.html +104 -0
- package/package.json +47 -0
- package/playwright.config.ts +78 -0
- package/public/circle.html +1 -0
- package/public/my_child_directive.html +1 -0
- package/public/my_directive.html +1 -0
- package/public/my_other_directive.html +1 -0
- package/public/test.html +1 -0
- package/rollup.config.js +31 -0
- package/src/animations/animateCache.js +55 -0
- package/src/animations/animateChildrenDirective.js +105 -0
- package/src/animations/animateCss.js +1139 -0
- package/src/animations/animateCssDriver.js +291 -0
- package/src/animations/animateJs.js +367 -0
- package/src/animations/animateJsDriver.js +67 -0
- package/src/animations/animateQueue.js +851 -0
- package/src/animations/animation.js +506 -0
- package/src/animations/module.js +779 -0
- package/src/animations/ngAnimateSwap.js +119 -0
- package/src/animations/rafScheduler.js +50 -0
- package/src/animations/shared.js +378 -0
- package/src/constants.js +20 -0
- package/src/core/animate.js +845 -0
- package/src/core/animateCss.js +73 -0
- package/src/core/animateRunner.js +195 -0
- package/src/core/attributes.js +199 -0
- package/src/core/cache.js +45 -0
- package/src/core/compile.js +4727 -0
- package/src/core/controller.js +225 -0
- package/src/core/exceptionHandler.js +63 -0
- package/src/core/filter.js +146 -0
- package/src/core/interpolate.js +442 -0
- package/src/core/interval.js +188 -0
- package/src/core/intervalFactory.js +57 -0
- package/src/core/location.js +1086 -0
- package/src/core/parser/parse.js +2562 -0
- package/src/core/parser/parse.md +13 -0
- package/src/core/q.js +746 -0
- package/src/core/rootScope.js +1596 -0
- package/src/core/sanitizeUri.js +85 -0
- package/src/core/sce.js +1161 -0
- package/src/core/taskTrackerFactory.js +125 -0
- package/src/core/timeout.js +121 -0
- package/src/core/urlUtils.js +187 -0
- package/src/core/utils.js +1349 -0
- package/src/directive/a.js +37 -0
- package/src/directive/attrs.js +283 -0
- package/src/directive/bind.js +51 -0
- package/src/directive/bind.md +142 -0
- package/src/directive/change.js +12 -0
- package/src/directive/change.md +25 -0
- package/src/directive/cloak.js +12 -0
- package/src/directive/cloak.md +24 -0
- package/src/directive/events.js +75 -0
- package/src/directive/events.md +166 -0
- package/src/directive/form.js +725 -0
- package/src/directive/init.js +15 -0
- package/src/directive/init.md +41 -0
- package/src/directive/input.js +1783 -0
- package/src/directive/list.js +46 -0
- package/src/directive/list.md +22 -0
- package/src/directive/ngClass.js +249 -0
- package/src/directive/ngController.js +64 -0
- package/src/directive/ngCsp.js +82 -0
- package/src/directive/ngIf.js +134 -0
- package/src/directive/ngInclude.js +217 -0
- package/src/directive/ngModel.js +1356 -0
- package/src/directive/ngModelOptions.js +509 -0
- package/src/directive/ngOptions.js +670 -0
- package/src/directive/ngRef.js +90 -0
- package/src/directive/ngRepeat.js +650 -0
- package/src/directive/ngShowHide.js +255 -0
- package/src/directive/ngSwitch.js +178 -0
- package/src/directive/ngTransclude.js +98 -0
- package/src/directive/non-bindable.js +11 -0
- package/src/directive/non-bindable.md +17 -0
- package/src/directive/script.js +30 -0
- package/src/directive/select.js +624 -0
- package/src/directive/style.js +25 -0
- package/src/directive/style.md +23 -0
- package/src/directive/validators.js +329 -0
- package/src/exts/aria.js +544 -0
- package/src/exts/messages.js +852 -0
- package/src/filters/filter.js +207 -0
- package/src/filters/filter.md +69 -0
- package/src/filters/filters.js +239 -0
- package/src/filters/json.md +16 -0
- package/src/filters/limit-to.js +43 -0
- package/src/filters/limit-to.md +19 -0
- package/src/filters/order-by.js +183 -0
- package/src/filters/order-by.md +83 -0
- package/src/index.js +13 -0
- package/src/injector.js +1034 -0
- package/src/jqLite.js +1117 -0
- package/src/loader.js +1320 -0
- package/src/public.js +215 -0
- package/src/routeToRegExp.js +41 -0
- package/src/services/anchorScroll.js +135 -0
- package/src/services/browser.js +321 -0
- package/src/services/cacheFactory.js +398 -0
- package/src/services/cookieReader.js +72 -0
- package/src/services/document.js +64 -0
- package/src/services/http.js +1537 -0
- package/src/services/httpBackend.js +206 -0
- package/src/services/log.js +160 -0
- package/src/services/templateRequest.js +139 -0
- package/test/angular.spec.js +2153 -0
- package/test/aria/aria.spec.js +1245 -0
- package/test/binding.spec.js +504 -0
- package/test/build-test.html +14 -0
- package/test/injector.spec.js +2327 -0
- package/test/jasmine/jasmine-5.1.2/boot0.js +65 -0
- package/test/jasmine/jasmine-5.1.2/boot1.js +133 -0
- package/test/jasmine/jasmine-5.1.2/jasmine-html.js +963 -0
- package/test/jasmine/jasmine-5.1.2/jasmine.css +320 -0
- package/test/jasmine/jasmine-5.1.2/jasmine.js +10824 -0
- package/test/jasmine/jasmine-5.1.2/jasmine_favicon.png +0 -0
- package/test/jasmine/jasmine-browser.json +17 -0
- package/test/jasmine/jasmine.json +9 -0
- package/test/jqlite.spec.js +2133 -0
- package/test/loader.spec.js +219 -0
- package/test/messages/messages.spec.js +1146 -0
- package/test/min-err.spec.js +174 -0
- package/test/mock-test.html +13 -0
- package/test/module-test.html +15 -0
- package/test/ng/anomate.spec.js +606 -0
- package/test/ng/cache-factor.spec.js +334 -0
- package/test/ng/compile.spec.js +17956 -0
- package/test/ng/controller-provider.spec.js +227 -0
- package/test/ng/cookie-reader.spec.js +98 -0
- package/test/ng/directive/a.spec.js +192 -0
- package/test/ng/directive/bind.spec.js +334 -0
- package/test/ng/directive/boolean.spec.js +136 -0
- package/test/ng/directive/change.spec.js +71 -0
- package/test/ng/directive/class.spec.js +858 -0
- package/test/ng/directive/click.spec.js +38 -0
- package/test/ng/directive/cloak.spec.js +44 -0
- package/test/ng/directive/constoller.spec.js +194 -0
- package/test/ng/directive/element-style.spec.js +92 -0
- package/test/ng/directive/event.spec.js +282 -0
- package/test/ng/directive/form.spec.js +1518 -0
- package/test/ng/directive/href.spec.js +143 -0
- package/test/ng/directive/if.spec.js +402 -0
- package/test/ng/directive/include.spec.js +828 -0
- package/test/ng/directive/init.spec.js +68 -0
- package/test/ng/directive/input.spec.js +3810 -0
- package/test/ng/directive/list.spec.js +170 -0
- package/test/ng/directive/model-options.spec.js +1008 -0
- package/test/ng/directive/model.spec.js +1905 -0
- package/test/ng/directive/non-bindable.spec.js +55 -0
- package/test/ng/directive/options.spec.js +3583 -0
- package/test/ng/directive/ref.spec.js +575 -0
- package/test/ng/directive/repeat.spec.js +1675 -0
- package/test/ng/directive/script.spec.js +52 -0
- package/test/ng/directive/scrset.spec.js +67 -0
- package/test/ng/directive/select.spec.js +2541 -0
- package/test/ng/directive/show-hide.spec.js +253 -0
- package/test/ng/directive/src.spec.js +157 -0
- package/test/ng/directive/style.spec.js +178 -0
- package/test/ng/directive/switch.spec.js +647 -0
- package/test/ng/directive/validators.spec.js +717 -0
- package/test/ng/document.spec.js +52 -0
- package/test/ng/filter/filter.spec.js +714 -0
- package/test/ng/filter/filters.spec.js +35 -0
- package/test/ng/filter/limit-to.spec.js +251 -0
- package/test/ng/filter/order-by.spec.js +891 -0
- package/test/ng/filter.spec.js +149 -0
- package/test/ng/http-backend.spec.js +398 -0
- package/test/ng/http.spec.js +4071 -0
- package/test/ng/interpolate.spec.js +642 -0
- package/test/ng/interval.spec.js +343 -0
- package/test/ng/location.spec.js +3488 -0
- package/test/ng/on.spec.js +229 -0
- package/test/ng/parse.spec.js +4655 -0
- package/test/ng/prop.spec.js +805 -0
- package/test/ng/q.spec.js +2904 -0
- package/test/ng/root-element.spec.js +16 -0
- package/test/ng/sanitize-uri.spec.js +249 -0
- package/test/ng/sce.spec.js +660 -0
- package/test/ng/scope.spec.js +3442 -0
- package/test/ng/template-request.spec.js +236 -0
- package/test/ng/timeout.spec.js +351 -0
- package/test/ng/url-utils.spec.js +156 -0
- package/test/ng/utils.spec.js +144 -0
- package/test/original-test.html +21 -0
- package/test/public.spec.js +34 -0
- package/test/sanitize/bing-html.spec.js +36 -0
- package/test/server/express.js +158 -0
- package/test/test-utils.js +11 -0
- package/tsconfig.json +17 -0
- package/types/angular.d.ts +138 -0
- package/types/global.d.ts +9 -0
- package/types/index.d.ts +2357 -0
- package/types/jqlite.d.ts +558 -0
- package/vite.config.js +14 -0
package/DEVELOPERS.md
ADDED
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
# Developing AngularJS
|
|
2
|
+
|
|
3
|
+
* [Development Setup](#setup)
|
|
4
|
+
* [Running Tests](#tests)
|
|
5
|
+
* [Coding Rules](#rules)
|
|
6
|
+
* [Commit Message Guidelines](#commits)
|
|
7
|
+
* [Writing Documentation](#documentation)
|
|
8
|
+
|
|
9
|
+
## <a name="setup"> Development Setup
|
|
10
|
+
|
|
11
|
+
This document describes how to set up your development environment to build and test AngularJS, and
|
|
12
|
+
explains the basic mechanics of using `git`, `node`, `yarn` and `grunt`.
|
|
13
|
+
|
|
14
|
+
### Installing Dependencies
|
|
15
|
+
|
|
16
|
+
Before you can build AngularJS, you must install and configure the following dependencies on your
|
|
17
|
+
machine:
|
|
18
|
+
|
|
19
|
+
* [Git](http://git-scm.com/): The [Github Guide to
|
|
20
|
+
Installing Git][git-setup] is a good source of information.
|
|
21
|
+
|
|
22
|
+
* [Node.js v8.x (LTS)](http://nodejs.org): We use Node to generate the documentation, run a
|
|
23
|
+
development web server, run tests, and generate distributable files. Depending on your system,
|
|
24
|
+
you can install Node either from source or as a pre-packaged bundle.
|
|
25
|
+
|
|
26
|
+
We recommend using [nvm](https://github.com/creationix/nvm) (or
|
|
27
|
+
[nvm-windows](https://github.com/coreybutler/nvm-windows))
|
|
28
|
+
to manage and install Node.js, which makes it easy to change the version of Node.js per project.
|
|
29
|
+
|
|
30
|
+
* [Yarn](https://yarnpkg.com): We use Yarn to install our Node.js module dependencies
|
|
31
|
+
(rather than using npm). See the detailed [installation instructions][yarn-install].
|
|
32
|
+
|
|
33
|
+
* [Java](http://www.java.com): We minify JavaScript using
|
|
34
|
+
[Closure Tools](https://developers.google.com/closure/), which require Java (version 7 or higher)
|
|
35
|
+
to be installed and included in your
|
|
36
|
+
[PATH](http://docs.oracle.com/javase/tutorial/essential/environment/paths.html) variable.
|
|
37
|
+
|
|
38
|
+
* [Grunt](http://gruntjs.com): We use Grunt as our build system. We're using it as a local dependency,
|
|
39
|
+
but you can also add the grunt command-line tool globally (with `yarn global add grunt-cli`), which allows
|
|
40
|
+
you to leave out the `yarn` prefix for all our grunt commands.
|
|
41
|
+
|
|
42
|
+
### Forking AngularJS on Github
|
|
43
|
+
|
|
44
|
+
To contribute code to AngularJS, you must have a GitHub account so you can push code to your own
|
|
45
|
+
fork of AngularJS and open Pull Requests in the [GitHub Repository][github].
|
|
46
|
+
|
|
47
|
+
To create a Github account, follow the instructions [here](https://github.com/signup/free).
|
|
48
|
+
Afterwards, go ahead and [fork](http://help.github.com/forking) the
|
|
49
|
+
[main AngularJS repository][github].
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### Building AngularJS
|
|
53
|
+
|
|
54
|
+
To build AngularJS, you clone the source code repository and use Grunt to generate the non-minified
|
|
55
|
+
and minified AngularJS files:
|
|
56
|
+
|
|
57
|
+
```shell
|
|
58
|
+
# Clone your Github repository:
|
|
59
|
+
git clone https://github.com/<github username>/angular.js.git
|
|
60
|
+
|
|
61
|
+
# Go to the AngularJS directory:
|
|
62
|
+
cd angular.js
|
|
63
|
+
|
|
64
|
+
# Add the main AngularJS repository as an upstream remote to your repository:
|
|
65
|
+
git remote add upstream "https://github.com/angular/angular.js.git"
|
|
66
|
+
|
|
67
|
+
# Install JavaScript dependencies:
|
|
68
|
+
yarn install
|
|
69
|
+
|
|
70
|
+
# Build AngularJS:
|
|
71
|
+
yarn grunt package
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Note:** If you're using Windows, you must use an elevated command prompt (right click, run as
|
|
75
|
+
Administrator). This is because `yarn grunt package` creates some symbolic links.
|
|
76
|
+
|
|
77
|
+
The build output is in the `build` directory. It consists of the following files and
|
|
78
|
+
directories:
|
|
79
|
+
|
|
80
|
+
* `angular-<version>.zip` — The complete zip file, containing all of the release build
|
|
81
|
+
artifacts.
|
|
82
|
+
|
|
83
|
+
* `angular.js` / `angular.min.js` — The regular and minified core AngularJS script file.
|
|
84
|
+
|
|
85
|
+
* `angular-*.js` / `angular-*.min.js` — All other AngularJS module script files.
|
|
86
|
+
|
|
87
|
+
* `docs/` — A directory that contains a standalone version of the docs
|
|
88
|
+
(same as served in `docs.angularjs.org`).
|
|
89
|
+
|
|
90
|
+
### <a name="local-server"></a> Running a Local Development Web Server
|
|
91
|
+
|
|
92
|
+
To debug code, run end-to-end tests, and serve the docs, it is often useful to have a local
|
|
93
|
+
HTTP server. For this purpose, we have made available a local web server based on Node.js.
|
|
94
|
+
|
|
95
|
+
1. To start the web server, run:
|
|
96
|
+
```shell
|
|
97
|
+
yarn grunt webserver
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
2. To access the local server, enter the following URL into your web browser:
|
|
101
|
+
```text
|
|
102
|
+
http://localhost:8000/
|
|
103
|
+
```
|
|
104
|
+
By default, it serves the contents of the AngularJS project directory.
|
|
105
|
+
|
|
106
|
+
3. To access the locally served docs, visit this URL:
|
|
107
|
+
```text
|
|
108
|
+
http://localhost:8000/build/docs/
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## <a name="tests"> Running Tests
|
|
112
|
+
|
|
113
|
+
### <a name="unit-tests"></a> Running the Unit Test Suite
|
|
114
|
+
|
|
115
|
+
We write unit and integration tests with Jasmine and execute them with Karma. To run all of the
|
|
116
|
+
tests once on Chrome run:
|
|
117
|
+
|
|
118
|
+
```shell
|
|
119
|
+
yarn grunt test:unit
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
To run the tests on other browsers use the command line flag:
|
|
123
|
+
|
|
124
|
+
```shell
|
|
125
|
+
yarn grunt test:unit --browsers=Chrome,Firefox
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Note:** there should be _no spaces between browsers_. `Chrome, Firefox` is INVALID.
|
|
129
|
+
|
|
130
|
+
If you have a Saucelabs or Browserstack account, you can also run the unit tests on these services
|
|
131
|
+
via our pre-defined customLaunchers. See the [karma config file](/karma-shared.conf.js) for all pre-configured browsers.
|
|
132
|
+
|
|
133
|
+
For example, to run the whole unit test suite on selected browsers:
|
|
134
|
+
|
|
135
|
+
```shell
|
|
136
|
+
# Browserstack
|
|
137
|
+
yarn grunt test:unit --browsers=BS_Chrome,BS_Firefox,BS_Safari,BS_IE_9,BS_IE_10,BS_IE_11,BS_EDGE,BS_iOS_10
|
|
138
|
+
# Saucelabs
|
|
139
|
+
yarn grunt test:unit --browsers=SL_Chrome,SL_Firefox,SL_Safari,SL_IE_9,SL_IE_10,SL_IE_11,SL_EDGE,SL_iOS_10
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Running these commands requires you to set up [Karma Browserstack][karma-browserstack] or
|
|
143
|
+
[Karma-Saucelabs][karma-saucelabs], respectively.
|
|
144
|
+
|
|
145
|
+
During development, however, it's more productive to continuously run unit tests every time the
|
|
146
|
+
source or test files change. To execute tests in this mode run:
|
|
147
|
+
|
|
148
|
+
1. To start the Karma server, capture Chrome browser and run unit tests, run:
|
|
149
|
+
|
|
150
|
+
```shell
|
|
151
|
+
yarn grunt autotest
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
2. To capture more browsers, open this URL in the desired browser (URL might be different if you
|
|
155
|
+
have multiple instance of Karma running, read Karma's console output for the correct URL):
|
|
156
|
+
|
|
157
|
+
```text
|
|
158
|
+
http://localhost:9876/
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
3. To re-run tests just change any source or test file.
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
To learn more about all of the preconfigured Grunt tasks run:
|
|
165
|
+
|
|
166
|
+
```shell
|
|
167
|
+
yarn grunt --help
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
### <a name="e2e-tests"></a> Running the End-to-end Test Suite
|
|
172
|
+
|
|
173
|
+
AngularJS's end to end tests are run with Protractor. Simply run:
|
|
174
|
+
|
|
175
|
+
```shell
|
|
176
|
+
yarn grunt test:e2e
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
This will start the webserver and run the tests on Chrome.
|
|
180
|
+
|
|
181
|
+
## <a name="rules"></a> Coding Rules
|
|
182
|
+
|
|
183
|
+
To ensure consistency throughout the source code, keep these rules in mind as you are working:
|
|
184
|
+
|
|
185
|
+
* All features or bug fixes **must be tested** by one or more [specs][unit-testing].
|
|
186
|
+
* All public API methods **must be documented** with ngdoc, an extended version of jsdoc (we added
|
|
187
|
+
support for markdown and templating via @ngdoc tag). To see how we document our APIs, please check
|
|
188
|
+
out the existing source code and see the section about [writing documentation](#documentation)
|
|
189
|
+
* With the exceptions listed below, we follow the rules contained in
|
|
190
|
+
[Google's JavaScript Style Guide][js-style-guide]:
|
|
191
|
+
* **Do not use namespaces**: Instead, wrap the entire AngularJS code base in an anonymous
|
|
192
|
+
closure and export our API explicitly rather than implicitly.
|
|
193
|
+
* Wrap all code at **100 characters**.
|
|
194
|
+
* Instead of complex inheritance hierarchies, we **prefer simple objects**. We use prototypal
|
|
195
|
+
inheritance only when absolutely necessary.
|
|
196
|
+
* We **love functions and closures** and, whenever possible, prefer them over objects.
|
|
197
|
+
* To write concise code that can be better minified, we **use aliases internally** that map to
|
|
198
|
+
the external API. See our existing code to see what we mean.
|
|
199
|
+
* We **don't go crazy with type annotations** for private internal APIs unless it's an internal
|
|
200
|
+
API that is used throughout AngularJS. The best guidance is to do what makes the most sense.
|
|
201
|
+
|
|
202
|
+
### Specific topics
|
|
203
|
+
|
|
204
|
+
#### Provider configuration
|
|
205
|
+
|
|
206
|
+
When adding configuration (options) to [providers][docs.provider], we follow a special pattern.
|
|
207
|
+
|
|
208
|
+
- for each option, add a `method` that ...
|
|
209
|
+
- works as a getter and returns the current value when called without argument
|
|
210
|
+
- works as a setter and returns itself for chaining when called with argument
|
|
211
|
+
- for boolean options, uses the naming scheme `<option>Enabled([enabled])`
|
|
212
|
+
- non-primitive options (e.g. objects) should be copied or the properties assigned explicitly to a
|
|
213
|
+
new object so that the configuration cannot be changed during runtime.
|
|
214
|
+
|
|
215
|
+
For a boolean config example, see [`$compileProvider#debugInfoEnabled`][code.debugInfoEnabled]
|
|
216
|
+
|
|
217
|
+
For an object config example, see [`$location.html5Mode`][code.html5Mode]
|
|
218
|
+
|
|
219
|
+
#### Throwing errors
|
|
220
|
+
|
|
221
|
+
User-facing errors should be thrown with [`minErr`][code.minErr], a special error function that provides
|
|
222
|
+
errors ids, templated error messages, and adds a link to a detailed error description.
|
|
223
|
+
|
|
224
|
+
The `$compile:badrestrict` error is a good example for a well-defined `minErr`:
|
|
225
|
+
[code][code.badrestrict] and [description][docs.badrestrict].
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
## <a name="commits"></a> Git Commit Guidelines
|
|
229
|
+
|
|
230
|
+
We have very precise rules over how our git commit messages can be formatted. This leads to **more
|
|
231
|
+
readable messages** that are easy to follow when looking through the **project history**. But also,
|
|
232
|
+
we use the git commit messages to **generate the AngularJS change log**.
|
|
233
|
+
|
|
234
|
+
The commit message formatting can be added using a typical git workflow or through the use of a CLI
|
|
235
|
+
wizard ([Commitizen](https://github.com/commitizen/cz-cli)). To use the wizard, run `yarn run commit`
|
|
236
|
+
in your terminal after staging your changes in git.
|
|
237
|
+
|
|
238
|
+
### Commit Message Format
|
|
239
|
+
Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
|
|
240
|
+
format that includes a **type**, a **scope** and a **subject**:
|
|
241
|
+
|
|
242
|
+
```
|
|
243
|
+
<type>(<scope>): <subject>
|
|
244
|
+
<BLANK LINE>
|
|
245
|
+
<body>
|
|
246
|
+
<BLANK LINE>
|
|
247
|
+
<footer>
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
The **header** is mandatory and the **scope** of the header is optional.
|
|
251
|
+
|
|
252
|
+
Any line of the commit message cannot be longer than 100 characters! This allows the message to be easier
|
|
253
|
+
to read on GitHub as well as in various git tools.
|
|
254
|
+
|
|
255
|
+
### Revert
|
|
256
|
+
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header
|
|
257
|
+
of the reverted commit.
|
|
258
|
+
In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit
|
|
259
|
+
being reverted.
|
|
260
|
+
|
|
261
|
+
### Type
|
|
262
|
+
Must be one of the following:
|
|
263
|
+
|
|
264
|
+
* **feat**: A new feature
|
|
265
|
+
* **fix**: A bug fix
|
|
266
|
+
* **docs**: Documentation only changes
|
|
267
|
+
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing
|
|
268
|
+
semi-colons, etc)
|
|
269
|
+
* **refactor**: A code change that neither fixes a bug nor adds a feature
|
|
270
|
+
* **perf**: A code change that improves performance
|
|
271
|
+
* **test**: Adding missing or correcting existing tests
|
|
272
|
+
* **chore**: Changes to the build process or auxiliary tools and libraries such as documentation
|
|
273
|
+
generation
|
|
274
|
+
|
|
275
|
+
### Scope
|
|
276
|
+
The scope could be anything specifying place of the commit change. For example `$location`,
|
|
277
|
+
`$browser`, `$compile`, `$rootScope`, `ngHref`, `ngClick`, `ngView`, etc...
|
|
278
|
+
|
|
279
|
+
You can use `*` when the change affects more than a single scope.
|
|
280
|
+
|
|
281
|
+
### Subject
|
|
282
|
+
The subject contains succinct description of the change:
|
|
283
|
+
|
|
284
|
+
* use the imperative, present tense: "change" not "changed" nor "changes"
|
|
285
|
+
* don't capitalize first letter
|
|
286
|
+
* no dot (.) at the end
|
|
287
|
+
|
|
288
|
+
### Body
|
|
289
|
+
Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes".
|
|
290
|
+
The body should include the motivation for the change and contrast this with previous behavior.
|
|
291
|
+
|
|
292
|
+
### Footer
|
|
293
|
+
The footer should contain any information about **Breaking Changes** and is also the place to
|
|
294
|
+
[reference GitHub issues that this commit closes][closing-issues].
|
|
295
|
+
|
|
296
|
+
**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines.
|
|
297
|
+
The rest of the commit message is then used for this.
|
|
298
|
+
|
|
299
|
+
A detailed explanation can be found in this [document][commit-message-format].
|
|
300
|
+
|
|
301
|
+
## <a name="documentation"></a> Writing Documentation
|
|
302
|
+
|
|
303
|
+
The AngularJS project uses a form of [jsdoc](http://usejsdoc.org/) called ngdoc for all of its code
|
|
304
|
+
documentation.
|
|
305
|
+
|
|
306
|
+
This means that all the docs are stored inline in the source code and so are kept in sync as it
|
|
307
|
+
changes.
|
|
308
|
+
|
|
309
|
+
There is also extra content (the developer guide, error pages, the tutorial,
|
|
310
|
+
and misceallenous pages) that live inside the AngularJS repository as markdown files.
|
|
311
|
+
|
|
312
|
+
This means that since we generate the documentation from the source code, we can easily provide
|
|
313
|
+
version-specific documentation by simply checking out a version of AngularJS and running the build.
|
|
314
|
+
|
|
315
|
+
Extracting the source code documentation, processing and building the docs is handled by the
|
|
316
|
+
documentation generation tool [Dgeni][dgeni].
|
|
317
|
+
|
|
318
|
+
### Building and viewing the docs locally
|
|
319
|
+
The docs can be built from scratch using grunt:
|
|
320
|
+
|
|
321
|
+
```shell
|
|
322
|
+
yarn grunt docs
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
This defers the doc-building task to `gulp`.
|
|
326
|
+
|
|
327
|
+
Note that the docs app is using the local build files to run. This means you might first have to run
|
|
328
|
+
the build:
|
|
329
|
+
|
|
330
|
+
```shell
|
|
331
|
+
yarn grunt build
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
(This is also necessary if you are making changes to minErrors).
|
|
335
|
+
|
|
336
|
+
To view the docs, see [Running a Local Development Web Server](#local-server).
|
|
337
|
+
|
|
338
|
+
### Writing jsdoc
|
|
339
|
+
The ngdoc utility has basic support for many of the standard jsdoc directives. But in particular it
|
|
340
|
+
is interested in the following block tags:
|
|
341
|
+
|
|
342
|
+
* `@name name` - the name of the ngdoc document
|
|
343
|
+
* `@param {type} name description` - describes a parameter of a function
|
|
344
|
+
* `@returns {type} description` - describes what a function returns
|
|
345
|
+
* `@requires` - normally indicates that a JavaScript module is required; in an Angular service it is
|
|
346
|
+
used to describe what other services this service relies on
|
|
347
|
+
* `@property` - describes a property of an object
|
|
348
|
+
* `@description` - used to provide a description of a component in markdown
|
|
349
|
+
* `@link` - specifies a link to a URL or a type in the API reference.
|
|
350
|
+
Links to the API have the following structure:
|
|
351
|
+
|
|
352
|
+
* the module namespace, followed by `.` (optional, default `ng`)
|
|
353
|
+
* the `@ngdoc` type (see below), followed by `:` (optional, automatically inferred)
|
|
354
|
+
* the name
|
|
355
|
+
* the method, property, or anchor (optional)
|
|
356
|
+
* the display name
|
|
357
|
+
|
|
358
|
+
For example: `{@link ng.type:$rootScope.Scope#$new Scope.$new()}`.
|
|
359
|
+
|
|
360
|
+
* `@example` - specifies an example. This can be a simple code block, or a
|
|
361
|
+
[runnable example](#the-example-tag).
|
|
362
|
+
* `@deprecated` - specifies that the following code is deprecated and should not be used.
|
|
363
|
+
In The AngularJS docs, there are two specific patterns which can be used to further describe
|
|
364
|
+
the deprecation: `sinceVersion="<version>"` and `removeVersion="<version>"`
|
|
365
|
+
|
|
366
|
+
The `type` in `@param` and `@returns` must be wrapped in `{}` curly braces, e.g. `{Object|Array}`.
|
|
367
|
+
Parameters can be made optional by *either* appending a `=` to the type, e.g. `{Object=}`, *or* by
|
|
368
|
+
putting the `[name]` in square brackets.
|
|
369
|
+
Default values are only possible with the second syntax by appending `=<value>` to the parameter
|
|
370
|
+
name, e.g. `@param {boolean} [ownPropsOnly=false]`.
|
|
371
|
+
|
|
372
|
+
Descriptions can contain markdown formatting.
|
|
373
|
+
|
|
374
|
+
#### AngularJS-specific jsdoc directives
|
|
375
|
+
|
|
376
|
+
In addition to the standard jsdoc tags, there are a number that are specific to the Angular
|
|
377
|
+
code-base:
|
|
378
|
+
|
|
379
|
+
* `@ngdoc` - specifies the type of thing being documented. See below for more detail.
|
|
380
|
+
* `@eventType emit|broadcast` - specifies whether the event is emitted or broadcast
|
|
381
|
+
* `@usage` - shows how to use a `function` or `directive`. Is usually automatically generated.
|
|
382
|
+
* `@knownIssue` - adds info about known quirks, problems, or limitations with the API, and possibly,
|
|
383
|
+
workarounds. This section is not for bugs.
|
|
384
|
+
|
|
385
|
+
The following are specific to directives:
|
|
386
|
+
|
|
387
|
+
* `@animations` - specifies the animations a directive supports
|
|
388
|
+
* `@multiElement` - specifies if a directive can span over multiple elements
|
|
389
|
+
* `@priority` - specifies a directive's priority
|
|
390
|
+
* `@restrict` - is extracted to show the usage of a directive. For example, for [E]lement,
|
|
391
|
+
[A]ttribute, and [C]lass, use `@restrict ECA`
|
|
392
|
+
* `@scope` - specifies that a directive will create a new scope
|
|
393
|
+
|
|
394
|
+
### The `@ngdoc` Directive
|
|
395
|
+
This directive helps to specify the template used to render the item being documented. For instance,
|
|
396
|
+
a directive would have different properties to a filter and so would be documented differently. The
|
|
397
|
+
commonly used types are:
|
|
398
|
+
|
|
399
|
+
* `overview` - a general page (guide, api index)
|
|
400
|
+
* `provider` - AngularJS provider, such as `$compileProvider` or `$httpProvider`.
|
|
401
|
+
* `service` - injectable AngularJS service, such as `$compile` or `$http`.
|
|
402
|
+
* `object` - well defined object (often exposed as a service)
|
|
403
|
+
* `function` - function that will be available to other methods (such as a helper function within
|
|
404
|
+
the ng module)
|
|
405
|
+
* `method` - method on an object/service/controller
|
|
406
|
+
* `property` - property on an object/service/controller
|
|
407
|
+
* `event` - AngularJS event that will propagate through the `$scope` tree.
|
|
408
|
+
* `directive` - AngularJS directive
|
|
409
|
+
* `filter` - AngularJS filter
|
|
410
|
+
* `error` - minErr error description
|
|
411
|
+
|
|
412
|
+
### General documentation with Markdown
|
|
413
|
+
|
|
414
|
+
Any text in tags can contain markdown syntax for formatting. Generally, you can use any markdown
|
|
415
|
+
feature.
|
|
416
|
+
|
|
417
|
+
#### Headings
|
|
418
|
+
|
|
419
|
+
Only use *h2* headings and lower, as the page title is set in *h1*. Also make sure you follow the
|
|
420
|
+
heading hierarchy. This ensures correct table of contents are created.
|
|
421
|
+
|
|
422
|
+
#### Code blocks
|
|
423
|
+
In line code can be specified by enclosing the code in back-ticks (\`).
|
|
424
|
+
A block of multi-line code can be enclosed in triple back-ticks (\`\`\`) but it is formatted better
|
|
425
|
+
if it is enclosed in <pre>...</pre> tags and the code lines themselves are indented.
|
|
426
|
+
|
|
427
|
+
### Writing runnable (live) examples and e2e tests
|
|
428
|
+
It is possible to embed examples in the documentation along with appropriate e2e tests. These
|
|
429
|
+
examples and scenarios will be converted to runnable code within the documentation. So it is
|
|
430
|
+
important that they work correctly. To ensure this, all these e2e scenarios are run as part of the
|
|
431
|
+
continuous integration tests.
|
|
432
|
+
|
|
433
|
+
If you are adding an example with an e2e test, you should [run the test locally](#e2e-tests) first
|
|
434
|
+
to ensure it passes. You can change `it(...)` to `fit(...)` to run only your test,
|
|
435
|
+
but make sure you change it back to `it(...)` before committing.
|
|
436
|
+
|
|
437
|
+
#### The `<example>` tag
|
|
438
|
+
This tag identifies a block of HTML that will define a runnable example. It can take the following
|
|
439
|
+
attributes:
|
|
440
|
+
|
|
441
|
+
* `animations` - if set to `true` then this example uses ngAnimate.
|
|
442
|
+
* `deps` - Semicolon-separated list of additional angular module files to be loaded,
|
|
443
|
+
e.g. `angular-animate.js`
|
|
444
|
+
* `name` - every example should have a name. It should start with the component, e.g directive name,
|
|
445
|
+
and not contain whitespace
|
|
446
|
+
* `module` - the name of the app module as defined in the example's JavaScript
|
|
447
|
+
|
|
448
|
+
Within this tag we provide `<file>` tags that specify what files contain the example code.
|
|
449
|
+
|
|
450
|
+
```
|
|
451
|
+
<example
|
|
452
|
+
module="angularAppModule"
|
|
453
|
+
name="exampleName"
|
|
454
|
+
deps="angular-animate.js;angular-route.js"
|
|
455
|
+
animations="true">
|
|
456
|
+
...
|
|
457
|
+
<file name="index.html">...</file>
|
|
458
|
+
<file name="script.js">...</file>
|
|
459
|
+
<file name="animations.css">...</file>
|
|
460
|
+
<file name="protractor.js">...</file>
|
|
461
|
+
...
|
|
462
|
+
</example>
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
You can see an example of a well-defined example [in the `ngRepeat` documentation][code.ngRepeat-example].
|
|
466
|
+
|
|
467
|
+
[closing-issues]: https://help.github.com/articles/closing-issues-via-commit-messages/
|
|
468
|
+
[Closure guide to i18n changes]: https://github.com/google/closure-library/wiki/Internationalization-%28i18n%29-changes-in-Closure-Library
|
|
469
|
+
[code.badrestrict]: https://github.com/angular/angular.js/blob/202f1809ad14827a6ac6a125157c605d65e0b551/src/ng/compile.js#L1107-L1110
|
|
470
|
+
[code.debugInfoEnabled]: https://github.com/angular/angular.js/blob/32fbb2e78f53d765fbb170f7cf99e42e072d363b/src/ng/compile.js#L1378-L1413
|
|
471
|
+
[code.html5Mode]: https://github.com/angular/angular.js/blob/202f1809ad14827a6ac6a125157c605d65e0b551/src/ng/location.js#L752-L797
|
|
472
|
+
[code.minErr]: https://github.com/angular/angular.js/blob/202f1809ad14827a6ac6a125157c605d65e0b551/src/minErr.js#L53-L113
|
|
473
|
+
[code.ngRepeat-example]: https://github.com/angular/angular.js/blob/0822d34b10ea0371c260c80a1486a4d508ea5a91/src/ng/directive/ngRepeat.js#L249-L340
|
|
474
|
+
[commit-message-format]: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#
|
|
475
|
+
[Common Locale Data Repository (CLDR)]: http://cldr.unicode.org
|
|
476
|
+
[corporate-cla]: http://code.google.com/legal/corporate-cla-v1.0.html
|
|
477
|
+
[dgeni]: https://github.com/angular/dgeni
|
|
478
|
+
[docs.badrestrict]: docs/content/error/$compile/badrestrict.ngdoc
|
|
479
|
+
[docs.provider]: https://code.angularjs.org/snapshot/docs/api/auto/service/$provide#provider
|
|
480
|
+
[git-revert]: https://git-scm.com/docs/git-revert
|
|
481
|
+
[git-setup]: https://help.github.com/articles/set-up-git
|
|
482
|
+
[github-issues]: https://github.com/angular/angular.js/issues
|
|
483
|
+
[github]: https://github.com/angular/angular.js
|
|
484
|
+
[js-style-guide]: https://google.github.io/styleguide/javascriptguide.xml
|
|
485
|
+
[karma-browserstack]: https://github.com/karma-runner/karma-browserstack-launcher
|
|
486
|
+
[karma-saucelabs]: https://github.com/karma-runner/karma-sauce-launcher
|
|
487
|
+
[unit-testing]: https://docs.angularjs.org/guide/unit-testing
|
|
488
|
+
[yarn-install]: https://yarnpkg.com/en/docs/install
|
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2010-2020 Google LLC. http://angularjs.org
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
22
|
+
|
package/Makefile
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.PHONY: build test
|
|
2
|
+
|
|
3
|
+
setup:
|
|
4
|
+
@npm i
|
|
5
|
+
@npm install --global rollup
|
|
6
|
+
|
|
7
|
+
build:
|
|
8
|
+
./node_modules/.bin/rollup -c
|
|
9
|
+
|
|
10
|
+
pretty:
|
|
11
|
+
@npx prettier ./src ./test --write
|
|
12
|
+
|
|
13
|
+
lint:
|
|
14
|
+
@npx eslint ./src --fix
|
|
15
|
+
|
|
16
|
+
check:
|
|
17
|
+
@echo "Typechecking Js"
|
|
18
|
+
./node_modules/.bin/tsc
|
|
19
|
+
|
|
20
|
+
serve:
|
|
21
|
+
@npm run serve
|
|
22
|
+
|
|
23
|
+
PLAYWRIGHT_TEST := npx playwright test
|
|
24
|
+
|
|
25
|
+
test:
|
|
26
|
+
@echo $(INFO) "Playwright test JS"
|
|
27
|
+
@$(PLAYWRIGHT_TEST)
|
|
28
|
+
|
|
29
|
+
test-ui:
|
|
30
|
+
@echo $(INFO) "Playwright test JS with ui"
|
|
31
|
+
@$(PLAYWRIGHT_TEST) --ui
|
package/README.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
AngularTS 
|
|
2
|
+
|
|
3
|
+
Building upon the monumental effort of the [Angular Team](https://docs.angularjs.org/misc/version-support-status) at Google,
|
|
4
|
+
this project preserves, modernises, and expands the original [AngularJS](https://github.com/angular/angular.js)
|
|
5
|
+
framework to what it could or should have been. While building on the core features of the original, AngularTS is not
|
|
6
|
+
a drop-in replacement or an LTS version. It has no relation to [Angular](https://angular.io) and makes no efforts to be compatible with it.
|
|
7
|
+
AngularTS is "AngularJS: The Good Parts". It takes the three core pillars of the original – a string-interpolation engine,
|
|
8
|
+
dependency injection, two-way data-binding – and adopts them to [Modern Web](https://modern-web.dev/) principles of being as close to Web standards as possible. The result is a buildless, progressive, and battle-tested JS framework, that make web-development great again.
|
|
9
|
+
|
|
10
|
+
AngularTS lets you write client-side web applications as if you had a smarter browser. It lets you
|
|
11
|
+
use good old HTML (or HAML, Jade/Pug and friends!) as your template language and lets you extend HTML’s
|
|
12
|
+
syntax to express your application’s components clearly and succinctly. It automatically
|
|
13
|
+
synchronizes data from your UI (view) with your JavaScript objects (model) through 2-way data
|
|
14
|
+
binding. To help you structure your application better and make it easy to test, AngularJS teaches
|
|
15
|
+
the browser how to do dependency injection and inversion of control.
|
|
16
|
+
|
|
17
|
+
It also helps with server-side communication, taming async callbacks with promises and deferred objects,
|
|
18
|
+
and it makes client-side navigation and deep linking with hashbang urls or HTML5 pushState a
|
|
19
|
+
piece of cake. Best of all? It makes development fun!
|
|
20
|
+
|
|
21
|
+
--------------------
|
|
22
|
+
|
|
23
|
+
**AngularJS support has officially ended as of January 2022.
|
|
24
|
+
[See what ending support means](https://docs.angularjs.org/misc/version-support-status)
|
|
25
|
+
and [read the end of life announcement](https://goo.gle/angularjs-end-of-life).**
|
|
26
|
+
|
|
27
|
+
**Visit [angular.io](https://angular.io) for the actively supported Angular.**
|
|
28
|
+
|
|
29
|
+
--------------------
|
|
30
|
+
|
|
31
|
+
* Web site: https://angularjs.org
|
|
32
|
+
* Tutorial: https://docs.angularjs.org/tutorial
|
|
33
|
+
* API Docs: https://docs.angularjs.org/api
|
|
34
|
+
* Developer Guide: https://docs.angularjs.org/guide
|
|
35
|
+
* Contribution guidelines: [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
36
|
+
* Core Development: [DEVELOPERS.md](DEVELOPERS.md)
|
|
37
|
+
* Dashboard: https://dashboard.angularjs.org
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
Documentation
|
|
41
|
+
--------------------
|
|
42
|
+
Go to https://docs.angularjs.org
|
|
43
|
+
|
|
44
|
+
Contribute
|
|
45
|
+
--------------------
|
|
46
|
+
|
|
47
|
+
We've set up a separate document for our
|
|
48
|
+
[contribution guidelines](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md).
|
|
49
|
+
|
|
50
|
+
Develop
|
|
51
|
+
--------------------
|
|
52
|
+
|
|
53
|
+
We've set up a separate document for
|
|
54
|
+
[developers](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md).
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
[](https://github.com/igrigorik/ga-beacon)
|
|
58
|
+
|
|
59
|
+
What to use AngularJS for and when to use it
|
|
60
|
+
---------
|
|
61
|
+
AngularJS is the next generation framework where each component is designed to work with every other
|
|
62
|
+
component in an interconnected way like a well-oiled machine. AngularJS is JavaScript MVC made easy
|
|
63
|
+
and done right. (Well it is not really MVC, read on, to understand what this means.)
|
|
64
|
+
|
|
65
|
+
#### MVC, no, MV* done the right way!
|
|
66
|
+
[MVC](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller), short for
|
|
67
|
+
Model-View-Controller, is a design pattern, i.e. how the code should be organized and how the
|
|
68
|
+
different parts of an application separated for proper readability and debugging. Model is the data
|
|
69
|
+
and the database. View is the user interface and what the user sees. Controller is the main link
|
|
70
|
+
between Model and View. These are the three pillars of major programming frameworks present on the
|
|
71
|
+
market today. On the other hand AngularJS works on MV*, short for Model-View-_Whatever_. The
|
|
72
|
+
_Whatever_ is AngularJS's way of telling that you may create any kind of linking between the Model
|
|
73
|
+
and the View here.
|
|
74
|
+
|
|
75
|
+
Unlike other frameworks in any programming language, where MVC, the three separate components, each
|
|
76
|
+
one has to be written and then connected by the programmer, AngularJS helps the programmer by asking
|
|
77
|
+
him/her to just create these and everything else will be taken care of by AngularJS.
|
|
78
|
+
|
|
79
|
+
#### Interconnection with HTML at the root level
|
|
80
|
+
AngularJS uses HTML to define the user's interface. AngularJS also enables the programmer to write
|
|
81
|
+
new HTML tags (AngularJS Directives) and increase the readability and understandability of the HTML
|
|
82
|
+
code. Directives are AngularJS’s way of bringing additional functionality to HTML. Directives
|
|
83
|
+
achieve this by enabling us to invent our own HTML elements. This also helps in making the code DRY
|
|
84
|
+
(Don't Repeat Yourself), which means once created, a new directive can be used anywhere within the
|
|
85
|
+
application.
|
|
86
|
+
|
|
87
|
+
HTML is also used to determine the wiring of the app. Special attributes in the HTML determine where
|
|
88
|
+
to load the app, which components or controllers to use for each element, etc. We specify "what"
|
|
89
|
+
gets loaded, but not "how". This declarative approach greatly simplifies app development in a sort
|
|
90
|
+
of WYSIWYG way. Rather than spending time on how the program flows and orchestrating the various
|
|
91
|
+
moving parts, we simply define what we want and AngularJS will take care of the dependencies.
|
|
92
|
+
|
|
93
|
+
#### Data Handling made simple
|
|
94
|
+
Data and Data Models in AngularJS are plain JavaScript objects and one can add and change properties
|
|
95
|
+
directly on it and loop over objects and arrays at will.
|
|
96
|
+
|
|
97
|
+
#### Two-way Data Binding
|
|
98
|
+
One of AngularJS's strongest features. Two-way Data Binding means that if something changes in the
|
|
99
|
+
Model, the change gets reflected in the View instantaneously, and the same happens the other way
|
|
100
|
+
around. This is also referred to as Reactive Programming, i.e. suppose `a = b + c` is being
|
|
101
|
+
programmed and after this, if the value of `b` and/or `c` is changed then the value of `a` will be
|
|
102
|
+
automatically updated to reflect the change. AngularJS uses its "scopes" as a glue between the Model
|
|
103
|
+
and View and makes these updates in one available for the other.
|
|
104
|
+
|
|
105
|
+
#### Less Written Code and Easily Maintainable Code
|
|
106
|
+
Everything in AngularJS is created to enable the programmer to end up writing less code that is
|
|
107
|
+
easily maintainable and readable by any other new person on the team. Believe it or not, one can
|
|
108
|
+
write a complete working two-way data binded application in less than 10 lines of code. Try and see
|
|
109
|
+
for yourself!
|
|
110
|
+
|
|
111
|
+
#### Testing Ready
|
|
112
|
+
AngularJS has Dependency Injection, i.e. it takes care of providing all the necessary dependencies
|
|
113
|
+
to its controllers and services whenever required. This helps in making the AngularJS code ready for
|
|
114
|
+
unit testing by making use of mock dependencies created and injected. This makes AngularJS more
|
|
115
|
+
modular and easily testable thus in turn helping a team create more robust applications.
|