You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: docs/content/misc/faq.ngdoc
+89-49
Original file line number
Diff line number
Diff line change
@@ -22,40 +22,33 @@ So it's definitely not a plugin or some other native browser extension.
22
22
23
23
### What is the AngularJS versioning strategy?
24
24
25
-
In Angular 1 we do not allow intentional breaking changes to appear in versions where only the "patch"
25
+
In AngularJS we do not allow intentional breaking changes to appear in versions where only the "patch"
26
26
number changes. For example between 1.3.12 and 1.3.13 there can be no breaking changes. We do allow
27
27
breaking changes happen between "minor" number changes. For example between 1.3.15 and 1.4.0 there
28
-
will be a number of breaking changes. We also allow breaking changes between beta releases of Angular.
28
+
are a number of breaking changes. That means AngularJS does not follow
29
+
[semantic versioning (semver)](http://semver.org/) where breaking changes are only
30
+
allowed when the "major" version changes.
31
+
32
+
We also allow breaking changes between beta releases of AngularJS.
29
33
For example between 1.4.0-beta.4 and 1.4.0-beta.5 there may be breaking changes. We try hard to minimize
30
34
these kinds of change only to those where there is a strong use case such as a strongly requested feature
31
-
improvement, a considerable simplification of the code or a measurable performance improvement.
32
-
33
-
When adding new code to branches of Angular, have a very stringent commit policy:
34
-
35
-
- Every commit must contain tests and documentation updates alongside the code changes and that all the
36
-
tests must pass;
37
-
- Commit messages must be written in a specific manner that allows us to parse them and extract the changes
38
-
for release notes.
39
-
40
-
The Angular code base has a very large set of unit tests (over 4000) and end to end tests, which are pretty
41
-
comprehensive. This means that a breaking change will require one or more tests to be changed to allow the
42
-
tests to pass. So when a commit includes tests that are being removed or modified, this is a flag that the
43
-
code might include a breaking change. When reviewing the commit we can then decide whether there really is
44
-
a breaking change and if it is appropriate for the branch to which it is being merged. If so, then we
45
-
require that the commit message contains an appropriate breaking change message.
35
+
improvement, a considerable simplification of the code, a measurable performance improvement, or a better
36
+
developer experience (especially with regard to upgrading to Angular).
46
37
47
-
Additionally, when a commit lands in our master repository it is synced to Google where we test it against
48
-
over 2000 applications using the test suites of these applications. This allows us to catch regressions
49
-
quickly before a release. We've had a pretty good experience with this setup. Only bugs that affect features
50
-
not used at Google or without sufficient test coverage, have a chance of making it through.
51
-
52
-
Lastly, when we are making a release we generate updates to the changelog directly from the commits. This
38
+
When we are making a release we generate updates to the changelog directly from the commits. This
53
39
generated update contains a highlighted section that contains all the breaking changes that have been
54
40
extracted from the commits. We can quickly see in the new changelog exactly what commits contain breaking
55
41
changes and so can application developers when they are deciding whether to update to a new version of
56
42
Angular.
57
43
44
+
Features with non-breaking changes can also appear in the "patch" version, e.g. in version 1.6.3 there might
45
+
be a feature that is not available in 1.6.2.
46
+
47
+
Finally, deprecation of features might also appear in "minor" version updates. That means the features
48
+
will still work in this version, but sometimes must be activated specifically.
49
+
58
50
#### When are deprecated features removed from the library?
51
+
59
52
Most of the time we remove a deprecated feature in a next minor version bump. For example, the
60
53
`preAssignBindingsEnabled` `$compileProvider` method was defined in AngularJS `1.5.10`, deprecated in `1.6` and
61
54
will be removed in `1.7`.
@@ -65,6 +58,53 @@ is also deprecated but we only remove the feature once it's removed from jQuery
65
58
jqLite and jQuery. One such example is the `bind` method, deprecated in favor of `on` but unlikely to be removed
66
59
from jqLite any time soon.
67
60
61
+
#### What is the version compatibility between AngularJS main and optional modules?
62
+
63
+
AngularJS code is separated into a main module ("angular"), and a few different optional modules
64
+
("angular-animate", "angular-route" etc) that are dependant on the main module.
65
+
When a new AngularJS version is released, all modules are updated to the new version.
66
+
This means that the main module and the optional modules must always have the exact same version,
67
+
down to the patch number, otherwise your application might break.
68
+
69
+
Therefore you must always explicitly lock down your dependencies, for example in the package.json,
70
+
the following means that "angular" and "angular-animate" are always updated to the same version:
71
+
72
+
```
73
+
{
74
+
"angular": "~1.6.0",
75
+
"angular-animate": "~1.6.0"
76
+
}
77
+
```
78
+
79
+
If you define exact versions, make sure core and optional modules are the same:
80
+
81
+
```
82
+
{
83
+
"angular": "1.6.3",
84
+
"angular-animate": "1.6.3"
85
+
}
86
+
```
87
+
88
+
89
+
#### How does AngularJS ensure code quality and guard against regressions?
90
+
91
+
When adding new code to AngularJS, we have a very stringent commit policy:
92
+
93
+
- Every commit must pass all existing tests, contain tests for code changes, and update the documentation
94
+
- Commit messages must be written in a specific manner that allows us to parse them and extract the changes
95
+
for release notes ([see the contributing guidelines](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md))
96
+
97
+
The AngularJS code base has a very large set of unit tests and end-to-end tests. This means that a breaking change will require one or more tests to be changed to allow the
98
+
tests to pass. So when a commit includes tests that are being removed or modified, this is a flag that the
99
+
code might include a breaking change. When reviewing the commit we can then decide whether there really is
100
+
a breaking change and if it is appropriate for the branch to which it is being merged. If so, then we
101
+
require that the commit message contains an appropriate breaking change message.
102
+
103
+
Additionally, commits are periodically synced to Google where we test it against applications using
104
+
the test suites of these applications. This allows us to catch regressions
105
+
quickly before a release. We've had a pretty good experience with this setup. Only bugs that affect features
106
+
not used at Google or without sufficient test coverage, have a chance of making it through.
107
+
68
108
69
109
### Is AngularJS a templating system?
70
110
@@ -96,11 +136,11 @@ Yes. See instructions in {@link downloading}.
96
136
97
137
98
138
99
-
### What browsers does Angular work with?
139
+
### What browsers does AngularJS work with?
100
140
101
141
We run our extensive test suite against the following browsers: the latest versions of Chrome,
102
-
Firefox, Safari, and Safari for iOs, as well as Internet Explorer versions 9-11. See {@link guide/ie
103
-
Internet Explorer Compatibility} for more details on supporting legacy IE browsers.
142
+
Firefox, Safari, and Safari for iOS, as well as Internet Explorer versions 9-11. See
143
+
{@link guide/ie Internet Explorer Compatibility} for more details on supporting legacy IE browsers.
104
144
105
145
If a browser is untested, it doesn't mean it won't work; for example, older Android (2.3.x)
106
146
is supported in the sense that we avoid the dot notation for reserved words as property names,
@@ -109,7 +149,7 @@ a large part of their codebase with a browser we test, such as Opera > version 1
109
149
(uses the Blink engine), or the various Firefox derivatives.
110
150
111
151
112
-
### What's Angular's performance like?
152
+
### What's AngularJS's performance like?
113
153
114
154
The startup time heavily depends on your network connection, state of the cache, browser used and
115
155
available hardware, but typically we measure bootstrap time in tens or hundreds of milliseconds.
@@ -124,40 +164,40 @@ illustration, we typically build snappy apps with hundreds or thousands of activ
124
164
The size of the file is ~50KB compressed and minified.
125
165
126
166
127
-
### Can I use the open-source Closure Library with Angular?
167
+
### Can I use the open-source Closure Library with AngularJS?
128
168
129
169
Yes, you can use widgets from the [Closure Library](https://developers.google.com/closure/library/)
130
-
in Angular.
170
+
in AngularJS.
131
171
132
172
133
-
### Does Angular use the jQuery library?
173
+
### Does AngularJS use the jQuery library?
134
174
135
-
Yes, Angular can use [jQuery](http://jquery.com/) if it's present in your app when the
136
-
application is being bootstrapped. If jQuery is not present in your script path, Angular falls back
175
+
Yes, AngularJS can use [jQuery](http://jquery.com/) if it's present in your app when the
176
+
application is being bootstrapped. If jQuery is not present in your script path, AngularJS falls back
137
177
to its own implementation of the subset of jQuery that we call {@link angular.element jQLite}.
138
178
139
-
Angular 1.3 only supports jQuery 2.1 or above. jQuery 1.7 and newer might work correctly with Angular
179
+
AngularJS 1.3 only supports jQuery 2.1 or above. jQuery 1.7 and newer might work correctly with AngularJS
140
180
but we don't guarantee that.
141
181
142
182
143
-
### What is testability like in Angular?
183
+
### What is testability like in AngularJS?
144
184
145
185
Very testable and designed this way from the ground up. It has an integrated dependency injection
146
186
framework, provides mocks for many heavy dependencies (server-side communication). See
The [MIT License](https://github.com/angular/angular.js/blob/master/LICENSE).
159
199
160
-
### Can I download and use the Angular logo artwork?
200
+
### Can I download and use the AngularJS logo artwork?
161
201
162
202
Yes! You can find design files in our github repository, under "[angular.js/images/logo](https://github.com/angular/angular.js/tree/master/images/logo)"
163
203
The logo design is licensed under a "[Creative Commons Attribution-ShareAlike 3.0 Unported License](http://creativecommons.org/licenses/by-sa/3.0/)". If you have some other use in mind, contact us.
@@ -178,7 +218,7 @@ For a smaller order, or for other countries, we suggest downloading the logo art
178
218
179
219
## Common Pitfalls
180
220
181
-
The Angular support channel (#angularjs on Freenode) sees a number of recurring pitfalls that new users of Angular fall into.
221
+
The AngularJS support channel (#angularjs on Freenode) sees a number of recurring pitfalls that new users of AngularJS fall into.
182
222
This document aims to point them out before you discover them the hard way.
183
223
184
224
### DOM Manipulation
@@ -189,13 +229,13 @@ Use built-in directives, or write your own where necessary, to do your DOM manip
189
229
See below about duplicating functionality.
190
230
191
231
If you're struggling to break the habit, consider removing jQuery from your app.
192
-
Really. Angular has the $http service and powerful directives that make it almost always unnecessary.
193
-
Angular's bundled jQLite has a handful of the features most commonly used in writing Angular directives, especially binding to events.
232
+
Really. AngularJS has the $http service and powerful directives that make it almost always unnecessary.
233
+
AngularJS's bundled jQLite has a handful of the features most commonly used in writing AngularJS directives, especially binding to events.
194
234
195
235
### Trying to duplicate functionality that already exists
196
236
197
237
There's a good chance that your app isn't the first to require certain functionality.
198
-
There are a few pieces of Angular that are particularly likely to be reimplemented out of old habits.
238
+
There are a few pieces of AngularJS that are particularly likely to be reimplemented out of old habits.
199
239
200
240
**ng-repeat**
201
241
@@ -208,7 +248,7 @@ Store the data from the server in an array on your `$scope`, and bind it to the
208
248
**ng-show**
209
249
210
250
`ng-show` gets this frequently too.
211
-
Conditionally showing and hiding things using jQuery is a common pattern in other apps, but Angular has a better way.
251
+
Conditionally showing and hiding things using jQuery is a common pattern in other apps, but AngularJS has a better way.
212
252
`ng-show` (and `ng-hide`) conditionally show and hide elements based on boolean expressions.
213
253
Describe the conditions for showing and hiding an element in terms of `$scope` variables:
214
254
@@ -221,7 +261,7 @@ Note especially the powerful `ng-switch` that should be used instead of several
221
261
222
262
`ng-class` is the last of the big three.
223
263
Conditionally applying classes to elements is another thing commonly done manually using jQuery.
224
-
Angular, of course, has a better way.
264
+
AngularJS, of course, has a better way.
225
265
You can give `ng-class` a whitespace-separated set of class names, and then it's identical to ordinary `class`.
226
266
That's not very exciting, so there's a second syntax:
227
267
@@ -235,22 +275,22 @@ Note also the handy `ng-class-even` and `ng-class-odd`, and the related though s
235
275
236
276
### `$watch` and `$apply`
237
277
238
-
Angular's two-way data binding is the root of all awesome in Angular.
278
+
AngularJS's two-way data binding is the root of all awesome in AngularJS.
239
279
However, it's not magic, and there are some situations where you need to give it a nudge in the right direction.
240
280
241
-
When you bind a value to an element in Angular using `ng-model`, `ng-repeat`, etc., Angular creates a `$watch` on that value.
281
+
When you bind a value to an element in AngularJS using `ng-model`, `ng-repeat`, etc., AngularJS creates a `$watch` on that value.
242
282
Then whenever a value on a scope changes, all `$watch`es observing that element are executed, and everything updates.
243
283
244
284
Sometimes, usually when you're writing a custom directive, you will have to define your own `$watch` on a scope value to make the directive react to changes.
245
285
246
286
On the flip side, sometimes you change a scope value in some code, but the app doesn't react to it.
247
-
Angular checks for scope variable changes after pieces of your code have finished running; for example, when `ng-click` calls a function on your scope, Angular will check for changes and react.
248
-
However, some code is outside of Angular and you'll have to call `scope.$apply()` yourself to trigger the update.
287
+
AngularJS checks for scope variable changes after pieces of your code have finished running; for example, when `ng-click` calls a function on your scope, AngularJS will check for changes and react.
288
+
However, some code is outside of AngularJS and you'll have to call `scope.$apply()` yourself to trigger the update.
249
289
This is most commonly seen in event handlers in custom directives.
250
290
251
291
### Combining `ng-repeat` with other directives
252
292
253
-
`ng-repeat` is extremely useful, one of the most powerful directives in Angular.
293
+
`ng-repeat` is extremely useful, one of the most powerful directives in AngularJS.
254
294
However the transformation it applies to the DOM is substantial.
255
295
Therefore applying other directives (such as `ng-show`, `ng-controller` and others) to the same element as `ng-repeat` generally leads to problems.
256
296
@@ -259,7 +299,7 @@ If you want to apply a directive to each inner piece of the repeat, put it on a
259
299
260
300
### `$rootScope` exists, but it can be used for evil
261
301
262
-
Scopes in Angular form a hierarchy, prototypically inheriting from a root scope at the top of the tree.
302
+
Scopes in AngularJS form a hierarchy, prototypically inheriting from a root scope at the top of the tree.
263
303
Usually this can be ignored, since most views have a controller, and therefore a scope, of their own.
264
304
265
305
Occasionally there are pieces of data that you want to make global to the whole app.
0 commit comments