From 5e3db61b1de79aae9cdec41173d930eb93c410dd Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Sun, 11 Mar 2012 15:32:51 -0700 Subject: docs(release): release notes for 1.0.0rc1 --- CHANGELOG.md | 281 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 278 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b964e57..985f4459 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,283 @@ - The Latest Stable Release: 0.9.19 canine-psychokinesis -- The Latest Unstable Release: 0.10.6 bubblewrap-cape +- The Latest Unstable Release: 1.0.0rc1 moiré-vision + + +# 1.0.0rc1 moiré-vision (in-progress) + +## $compile rewrite + +The compiler was completely rewritten from scratch using ideas from this +[design document](https://docs.google.com/document/d/1PNh4lxlYpSRK2RhEwD4paJLMwdcnddcYJn3rsDsdayc/edit). +Please check out the [$compile] and +[$compileProvider.directive](http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive) +docs. The biggest improvements and changes are listed below. + +- the compiler now transparently supports several directive syntaxes. For example while before there + was just one way to use `ng:include` directive: ``. The new + compiler treats all of the following as equivalent: + + - `` + - `` + - `` + - `
` + - `
` + - `
` + - `
` + - `
` + - `
` + - `
` + + This will give template creators great flexibility to consider the tradeoffs between html code + validity and code conciseness and pick the syntax that works the best for them. + +- we are switching all of our code/docs/examples to use `ng-foo` directive name style instead of + `ng:foo`. The new compiler doesn't distinguish between these and other name styles (all of them + are [equally supported](http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive)), + the main difference is that `ng-foo` is easier to select with css selectors. Check out the + [Internet Explorer Compatibility](http://docs-next.angularjs.org/guide/ie.ngdoc) + doc to learn about various IE-related requirements for different directive naming styles. + +- `angular.directive`, `angular.widget`, `angular.attrWidget` were merged into a single concept: a + `directive` which is registered via + [myModule.directive](http://docs-next.angularjs.org/api/angular.Module#directive) or + [$compileProvider.directive](http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive). + You can control execution priority of multiple directives on the same element (previously the main + difference between a attribute widget and a directive) via a directive priority setting. + +- previously the linking functions of directives were called top to bottom following the DOM tree, + to enable a linking fn to work child DOM nodes that were already processed by child linking fns + the order was changed as follows: compile functions run top to bottom following the DOM tree, but + linking functions run bottom-up following the DOM tree. In some rare cases it is desirable for + linking fns to be called top to bottom and for these it is possible to register "prelinking" + functions (check out + [the docs](http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive) + for the return value of the compile function). + +- `angular.markup` and `angular.attrMarkup` were replaced with interpolation via `$interpolate` + service. + + - In the past `{{foo}}` markup was getting translated to `` during the + early stage of template compilation. Addition of this extra node was in some cases undesirable + and caused problems. The new compiler with the help of the $interpolate service removes the need + for these artificial nodes. + + - As a side-effect of not using artificial nodes available for all bindings, the `html` filter + which used to innerHTML (sanitized) html into the artificial node was converted into a directive. + So instead of `{{ someRawHtml | html }}` use `
` and + instead of `{{ someRawHtml | html:"unsafe" }}` use `
`. + Please check out the + [ng-bind-html](http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive.ng-bind-html) + and + [ng-bind-html-unsafe](http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive.ng-bind-html-unsafe) + directive docs. + + - Custom markup has been used by developers only to switch from `{{ }}` markup to `(( ))` or + something similar in order to avoid conflicts with server-side templating libraries. We made it + easier to do this kind of customization by making the start and end symbol of the interpolation + configurable via [$interpolateProvider](http://docs-next.angularjs.org/api/angular.module.ng.$interpolateProvider). + +- [template loader](http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive.script) + loads template fragments from script elements and populates the $templateCache with them. Templates + loaded in this way can be then used with `ng-include`, `ng-view` as well as directive templates + (see the `templateUrl` property of the + [directive config object](http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive)). + + +## Forms / input controls / two-way data binding + +The implementation of forms and input bindings was modified to address issues around composability, +ease of adding custom validation and formatting. Please check out the +[forms dev guide article](http://docs-next.angularjs.org/guide/dev_guide.forms) to learn about forms, +form control bindings and input validation. The biggest changes are listed below. + +- any directive can add formatter/parser (validators, convertors) to an input type. This allows + better composability of input types with custom validators and formatters. So instead of creating + new custom input type for everything, it's now possible to take existing input type and add an + additional formatter and/or validator to it via a custom directive. + +- inputs propagates changes only on the blur event by default (use new `ng-model-instant` directive + if you want to propagate changes on each keystroke). + +- no more custom input types, use directives to customize existing types. + +- removed $formFactory. + +- removed parallel scope hierarchy (forms, widgets). + +- removed `list` input type (use `ng-list` directive instead). + +- removed integer input type. + + +## Controller-scope separation + +Controllers are now standalone objects, created using the "new" operator, and not mixed with scope +object anymore. This addresses many issues including: +[#321](https://github.com/angular/angular.js/issues/321) and +[#425](https://github.com/angular/angular.js/issues/425). + +The [design doc](https://docs.google.com/document/pub?id=1SsgVj17ec6tnZEX3ugsvg0rVVR11wTso5Md-RdEmC0k) +explains the reasoning for this major change and how it solves many issues. + +### Before: + +
+function MyCtrl() {
+  var self = this;
+
+  this.model = 'some model of any type';
+
+  this.fnUsedFromTemplate = function() {
+    someApiThatTakesCallback(function callbackFn() {
+      self.model = 'updatedModel';
+    });
+  };
+}
+
+ +### After: + +
+function MyCtrl($scope) {
+  $scope.mode = 'some model of any type';
+
+  $scope.fnUsedFromTemplate = function() {
+    someApiThatTakesCallback(function() {
+      $scope.model = 'updatedModel';
+    });
+  }
+}
+
+ +Temporary backwards compatibility: Load the following module in your app to recreate the previous +behavior and migrate your controllers one at a time: + + +## $route service changes + +- As advertised in the past we moved the $route configuration from the run phase of the application + to the config phase. This means that instead of defining routes via `$route.when`/`$route.otherwise` + you should use `$routeProvider.when`/`$routeProvider.otherwise` instead. + +- route scope is now being created by the `ng-view` rather than by `$route`, this resolved many + issues we've previously faced. For more info, read the + [commit message](https://github.com/angular/angular.js/commit/60743fc52aea9eabee58258a31f4ba465013cb4e). + +- removed `$route.parent()` - it's unnecessary because the scope is properly created in the scope + hierarchy by `ng-view`. + +- new `$viewContentLoaded` and `$includeContentLoaded` events which directives can use to be + notified when a template content is (re)loaded. + +- `ng-view` now has `onload` attribute which behaves similarly to the one on `ng-include`. + + +## Directives + +- `ng-model` binding on select[multiple] element should support binding to an array + ([commit](https://github.com/angular/angular.js/commit/85b2084f578652cc0dcba46c689683fc550554fe)) +- event object is now accessible as `$event` in `ng-click` and other directives + ([commit](https://github.com/angular/angular.js/commit/1752c8c44a7058e974ef208e583683eac8817789), + issue [#259](https://github.com/angular/angular.js/issues/259) +- `ng-class` directive now support map of classnames and conditions + e.g. `
-# 0.10.7 moiré-vision (in-progress) -- cgit v1.2.3