docs: convert the last `my-app` components to `app-root` (#42256)
Most of these were fixed in other PRs but there were are couple of stragglers. Note that `my-app` components in non-documentation facing code, such as compliance tests have not been changed. Fixes #20235 PR Close #42256
This commit is contained in:
parent
6da0c97423
commit
c2ed612da3
|
@ -1,7 +1,7 @@
|
|||
import { Component, VERSION } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'my-app',
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: [ './app.component.css' ]
|
||||
})
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
<title>Angular App</title>
|
||||
</head>
|
||||
<body>
|
||||
<my-app>loading</my-app>
|
||||
<app-root>loading</app-root>
|
||||
</body>
|
||||
</html>
|
|
@ -156,7 +156,7 @@ The `AppComponent` template uses this component as follows:
|
|||
|
||||
```ts
|
||||
@Component({
|
||||
selector: 'my-app',
|
||||
selector: 'app-root',
|
||||
template: '<user-detail [user]="selectedUser" />',
|
||||
})
|
||||
export class AppComponent {
|
||||
|
|
|
@ -17,7 +17,7 @@ export class TooltipDirective {
|
|||
}
|
||||
|
||||
@Component({
|
||||
selector: 'my-app',
|
||||
selector: 'app-root',
|
||||
template: 'Hello World!'
|
||||
})
|
||||
class MyAppComponent {
|
||||
|
|
|
@ -31,17 +31,19 @@ import {getTNode, unwrapRNode} from './view_utils';
|
|||
*
|
||||
* @usageNotes
|
||||
* Given the following DOM structure:
|
||||
*
|
||||
* ```html
|
||||
* <my-app>
|
||||
* <app-root>
|
||||
* <div>
|
||||
* <child-comp></child-comp>
|
||||
* </div>
|
||||
* </my-app>
|
||||
* </app-root>
|
||||
* ```
|
||||
*
|
||||
* Calling `getComponent` on `<child-comp>` will return the instance of `ChildComponent`
|
||||
* associated with this DOM element.
|
||||
*
|
||||
* Calling the function on `<my-app>` will return the `MyApp` instance.
|
||||
* Calling the function on `<app-root>` will return the `MyApp` instance.
|
||||
*
|
||||
*
|
||||
* @param element DOM element from which the component should be retrieved.
|
||||
|
@ -177,12 +179,14 @@ export function getInjectionTokens(element: Element): any[] {
|
|||
*
|
||||
* @usageNotes
|
||||
* Given the following DOM structure:
|
||||
* ```
|
||||
* <my-app>
|
||||
*
|
||||
* ```html
|
||||
* <app-root>
|
||||
* <button my-button></button>
|
||||
* <my-comp></my-comp>
|
||||
* </my-app>
|
||||
* </app-root>
|
||||
* ```
|
||||
*
|
||||
* Calling `getDirectives` on `<button>` will return an array with an instance of the `MyButton`
|
||||
* directive that is associated with the DOM node.
|
||||
*
|
||||
|
@ -360,14 +364,16 @@ export interface Listener {
|
|||
*
|
||||
* @usageNotes
|
||||
* Given the following DOM structure:
|
||||
* ```
|
||||
* <my-app>
|
||||
* <div (click)="doSomething()"></div>
|
||||
* </my-app>
|
||||
*
|
||||
* ```html
|
||||
* <app-root>
|
||||
* <div (click)="doSomething()"></div>
|
||||
* </app-root>
|
||||
* ```
|
||||
*
|
||||
* Calling `getListeners` on `<div>` will return an object that looks as follows:
|
||||
* ```
|
||||
*
|
||||
* ```ts
|
||||
* {
|
||||
* name: 'click',
|
||||
* element: <div>,
|
||||
|
|
|
@ -109,7 +109,7 @@ export class ViewRef<T> implements viewEngine_EmbeddedViewRef<T>, viewEngine_Int
|
|||
*
|
||||
* ```typescript
|
||||
* @Component({
|
||||
* selector: 'my-app',
|
||||
* selector: 'app-root',
|
||||
* template: `Number of ticks: {{numberOfTicks}}`
|
||||
* changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
* })
|
||||
|
@ -231,7 +231,7 @@ export class ViewRef<T> implements viewEngine_EmbeddedViewRef<T>, viewEngine_Int
|
|||
* }
|
||||
*
|
||||
* @Component({
|
||||
* selector: 'my-app',
|
||||
* selector: 'app-root',
|
||||
* providers: [DataProvider],
|
||||
* template: `
|
||||
* Live Update: <input type="checkbox" [(ngModel)]="live">
|
||||
|
|
|
@ -11,7 +11,7 @@ import {Component, NgModule} from '@angular/core';
|
|||
import {BrowserModule} from '@angular/platform-browser';
|
||||
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
|
||||
|
||||
@Component({selector: 'my-app', template: 'empty'})
|
||||
@Component({selector: 'app-root', template: 'empty'})
|
||||
class MyApp {
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import {Component, NgModule} from '@angular/core';
|
|||
import {BrowserModule} from '@angular/platform-browser';
|
||||
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
|
||||
|
||||
@Component({selector: 'my-app', template: 'Hello {{ name }}!'})
|
||||
@Component({selector: 'app-root', template: 'Hello {{ name }}!'})
|
||||
class MyApp {
|
||||
name: string = 'World';
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import {FormsModule} from '@angular/forms';
|
|||
|
||||
// #docregion mark-for-check
|
||||
@Component({
|
||||
selector: 'my-app',
|
||||
selector: 'app-root',
|
||||
template: `Number of ticks: {{numberOfTicks}}`,
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
|
|
|
@ -10,7 +10,7 @@ import {Component, ViewEncapsulation} from '@angular/core';
|
|||
|
||||
// #docregion longform
|
||||
@Component({
|
||||
selector: 'my-app',
|
||||
selector: 'app-root',
|
||||
template: `
|
||||
<h1>Hello World!</h1>
|
||||
<span class="red">Shadow DOM Rocks!</span>
|
||||
|
|
|
@ -10,7 +10,7 @@ import {Component, createPlatformFactory} from '@angular/core';
|
|||
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
|
||||
|
||||
// #docregion longform
|
||||
@Component({selector: 'my-app', template: 'Hello World'})
|
||||
@Component({selector: 'app-root', template: 'Hello World'})
|
||||
class MyApp {
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import {ɵresetJitOptions as resetJitOptions} from '@angular/core';
|
|||
*
|
||||
* ```
|
||||
* describe('something', () => {
|
||||
* it('should do something', withBody('<my-app></my-app>', async () => {
|
||||
* it('should do something', withBody('<app-root></app-root>', async () => {
|
||||
* const myApp = renderComponent(MyApp);
|
||||
* await whenRendered(myApp);
|
||||
* expect(getRenderedText(myApp)).toEqual('Hello World!');
|
||||
|
|
Loading…
Reference in New Issue