fix(angular1-router): add support for using the component helper#6796
fix(angular1-router): add support for using the component helper#6796petebacondarwin wants to merge 1 commit intoangular:masterfrom
Conversation
19f8fc0 to
6fa2143
Compare
In Angular 1.5 there is a new helper method for creating component directives. See https://docs.angularjs.org/guide/component for more information about components. These kind of directives only match the `E` element form and the previously component router only created HTML that matched directives that matched the `A` attribute form. This commit changes the `<ng-outlet>` directive so that it generates custom HTML elements rather divs with custom attributes to trigger the relevant component to appear in the DOM. Going forward, Angular 1.5 users are encouraged to create their router components using the following style: ``` myModule.componnet('component-name', { // component definition object }); ``` Closes angular/angular.js#13860 Closes angular#6076 Closes angular#5278 BREAKING CHANGE: The component router now creates custom element HTML rather than custom attribute HTML, in order to create a new component. So rather than ```html <div custom-component></div> ``` it now creates ```html <custom-component></custom-component> ``` If you defined you router components using the `directive()` helper and specified the `restrict` properties such that element matching was not allowed, e.g. `restrict: 'A'` then these components will no longer be instantiated by the component router and the outlet will be empty. The fix is to include `E` in the `restrict` property. `restrict: 'EA'` Note that this does not affect directives that did not specify the `restrict` property as the default for this property is already `EA`.
6fa2143 to
e9f96e0
Compare
There was a problem hiding this comment.
we should double check that this version bump doesn't affect benchmarks, etc.
There was a problem hiding this comment.
How do we do that?
Are the benchmarks run as part of the CI builds?
|
LGTM, not sure what the circle CI failure is about. |
|
Hi Pete, go ahead and merge this when you're ready. |
|
Could you provided latest compiled version of router i.e. .js file |
|
Closed via d86be24 |
|
Is there a way to get this updated component router through bower, for using with Angular 1.5.x? |
|
The router is published via npm: |
|
As of today, it seems the version published with npm does not contain the fix |
|
BTW, it's now available on npm (version 0.2.0). |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
In Angular 1.5 there is a new helper method for creating component directives.
See https://docs.angularjs.org/guide/component for more information about components.
These kind of directives only match the
Eelement form and the previously componentrouter only created HTML that matched directives that matched the
Aattribute form.This commit changes the
<ng-outlet>directive so that it generates custom HTMLelements rather divs with custom attributes to trigger the relevant component to
appear in the DOM.
Going forward, Angular 1.5 users are encouraged to create their router components
using the following style:
Closes angular/angular.js#13860
Closes #5278
BREAKING CHANGE:
The component router now creates custom element HTML rather than custom attribute
HTML, in order to create a new component. So rather than
it now creates
If you defined you router components using the
directive()helper andspecified the
restrictproperties such that element matching was not allowed,e.g.
restrict: 'A'then these components will no longer be instantiatedby the component router and the outlet will be empty.
The fix is to include
Ein therestrictproperty.restrict: 'EA'Note that this does not affect directives that did not specify the
restrictproperty as the default for this property is already
EA.