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
Copy file name to clipboardExpand all lines: a1/README.md
+29
Original file line number
Diff line number
Diff line change
@@ -56,6 +56,7 @@ While this guide explains the *what*, *why* and *how*, I find it helpful to see
56
56
1.[Routing](#routing)
57
57
1.[Task Automation](#task-automation)
58
58
1.[Filters](#filters)
59
+
1.[Low Level Functions](#low-level-functions)
59
60
1.[Angular Docs](#angular-docs)
60
61
61
62
## Single Responsibility
@@ -3268,6 +3269,34 @@ Use [Gulp](http://gulpjs.com) or [Grunt](http://gruntjs.com) for creating automa
3268
3269
3269
3270
**[Back to top](#table-of-contents)**
3270
3271
3272
+
## Low Level Functions
3273
+
3274
+
Angular 1.x ships with some [helper functions](https://docs.angularjs.org/api/ng/function) that are found within JavaScript natively. In such cases we should favor usage of native JavaScript functions instead of Angular's helper functions. In other cases where functionality is not found in JavaScript natively, we should turn to utility libraries such as [lodash](https://lodash.com/docs) to fill-in the gaps. Here are some examples:
|`angular.extend()` | `Object.assign()` | _available in ES2015+_ |
3284
+
3285
+
3286
+
###### [Style [Y500](#style-y500)]
3287
+
3288
+
- Avoid using Angular low-level functions such as `angular.copy()`, `angular.extend()` or even `angular.isUndefined()`.
3289
+
3290
+
*Why?*: You can replace a lot Angular's low-level functions with native ES2015+ functionality such as [`Object.assign()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) for copying objects and the [Spread Syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator#Copy_an_array) for copying arrays _(ie. `[...arr1]`)_.
3291
+
3292
+
*Why?*: This will ease the process of upgrading to Angular 2 as it does not ship with these helper functions.
3293
+
3294
+
- Note: Favor usage of functions that are available in JavaScript natively, then resort to using a utility library like [lodash](https://lodash.com/docs) when what you need is not available.
3295
+
3296
+
- Note: you might need to use a [polyfill](https://babeljs.io/docs/usage/polyfill/) to take advantage the latest features of JavaScript for better browser support.
0 commit comments