Skip to content
This repository was archived by the owner on Jan 19, 2023. It is now read-only.

Commit c2ed612

Browse files
petebacondarwinzarend
authored andcommitted
docs: convert the last my-app components to app-root (angular#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 angular#20235 PR Close angular#42256
1 parent 6da0c97 commit c2ed612

File tree

12 files changed

+29
-23
lines changed

12 files changed

+29
-23
lines changed

aio/content/examples/routing-with-urlmatcher/src/app/app.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component, VERSION } from '@angular/core';
22

33
@Component({
4-
selector: 'my-app',
4+
selector: 'app-root',
55
templateUrl: './app.component.html',
66
styleUrls: [ './app.component.css' ]
77
})

aio/content/examples/routing-with-urlmatcher/src/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
<title>Angular App</title>
55
</head>
66
<body>
7-
<my-app>loading</my-app>
7+
<app-root>loading</app-root>
88
</body>
99
</html>

aio/content/guide/template-typecheck.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ The `AppComponent` template uses this component as follows:
156156

157157
```ts
158158
@Component({
159-
selector: 'my-app',
159+
selector: 'app-root',
160160
template: '<user-detail [user]="selectedUser" />',
161161
})
162162
export class AppComponent {

packages/core/src/render3/STORING_METADATA_IN_D.TS.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class TooltipDirective {
1717
}
1818

1919
@Component({
20-
selector: 'my-app',
20+
selector: 'app-root',
2121
template: 'Hello World!'
2222
})
2323
class MyAppComponent {

packages/core/src/render3/util/discovery_utils.ts

+17-11
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,19 @@ import {getTNode, unwrapRNode} from './view_utils';
3131
*
3232
* @usageNotes
3333
* Given the following DOM structure:
34+
*
3435
* ```html
35-
* <my-app>
36+
* <app-root>
3637
* <div>
3738
* <child-comp></child-comp>
3839
* </div>
39-
* </my-app>
40+
* </app-root>
4041
* ```
42+
*
4143
* Calling `getComponent` on `<child-comp>` will return the instance of `ChildComponent`
4244
* associated with this DOM element.
4345
*
44-
* Calling the function on `<my-app>` will return the `MyApp` instance.
46+
* Calling the function on `<app-root>` will return the `MyApp` instance.
4547
*
4648
*
4749
* @param element DOM element from which the component should be retrieved.
@@ -177,12 +179,14 @@ export function getInjectionTokens(element: Element): any[] {
177179
*
178180
* @usageNotes
179181
* Given the following DOM structure:
180-
* ```
181-
* <my-app>
182+
*
183+
* ```html
184+
* <app-root>
182185
* <button my-button></button>
183186
* <my-comp></my-comp>
184-
* </my-app>
187+
* </app-root>
185188
* ```
189+
*
186190
* Calling `getDirectives` on `<button>` will return an array with an instance of the `MyButton`
187191
* directive that is associated with the DOM node.
188192
*
@@ -360,14 +364,16 @@ export interface Listener {
360364
*
361365
* @usageNotes
362366
* Given the following DOM structure:
363-
* ```
364-
* <my-app>
365-
* <div (click)="doSomething()"></div>
366-
* </my-app>
367367
*
368+
* ```html
369+
* <app-root>
370+
* <div (click)="doSomething()"></div>
371+
* </app-root>
368372
* ```
373+
*
369374
* Calling `getListeners` on `<div>` will return an object that looks as follows:
370-
* ```
375+
*
376+
* ```ts
371377
* {
372378
* name: 'click',
373379
* element: <div>,

packages/core/src/render3/view_ref.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export class ViewRef<T> implements viewEngine_EmbeddedViewRef<T>, viewEngine_Int
109109
*
110110
* ```typescript
111111
* @Component({
112-
* selector: 'my-app',
112+
* selector: 'app-root',
113113
* template: `Number of ticks: {{numberOfTicks}}`
114114
* changeDetection: ChangeDetectionStrategy.OnPush,
115115
* })
@@ -231,7 +231,7 @@ export class ViewRef<T> implements viewEngine_EmbeddedViewRef<T>, viewEngine_Int
231231
* }
232232
*
233233
* @Component({
234-
* selector: 'my-app',
234+
* selector: 'app-root',
235235
* providers: [DataProvider],
236236
* template: `
237237
* Live Update: <input type="checkbox" [(ngModel)]="live">

packages/examples/compiler/ts/url_resolver/url_resolver.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {Component, NgModule} from '@angular/core';
1111
import {BrowserModule} from '@angular/platform-browser';
1212
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
1313

14-
@Component({selector: 'my-app', template: 'empty'})
14+
@Component({selector: 'app-root', template: 'empty'})
1515
class MyApp {
1616
}
1717

packages/examples/core/ts/bootstrap/bootstrap.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {Component, NgModule} from '@angular/core';
1010
import {BrowserModule} from '@angular/platform-browser';
1111
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
1212

13-
@Component({selector: 'my-app', template: 'Hello {{ name }}!'})
13+
@Component({selector: 'app-root', template: 'Hello {{ name }}!'})
1414
class MyApp {
1515
name: string = 'World';
1616
}

packages/examples/core/ts/change_detect/change-detection.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {FormsModule} from '@angular/forms';
1212

1313
// #docregion mark-for-check
1414
@Component({
15-
selector: 'my-app',
15+
selector: 'app-root',
1616
template: `Number of ticks: {{numberOfTicks}}`,
1717
changeDetection: ChangeDetectionStrategy.OnPush,
1818
})

packages/examples/core/ts/metadata/encapsulation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {Component, ViewEncapsulation} from '@angular/core';
1010

1111
// #docregion longform
1212
@Component({
13-
selector: 'my-app',
13+
selector: 'app-root',
1414
template: `
1515
<h1>Hello World!</h1>
1616
<span class="red">Shadow DOM Rocks!</span>

packages/examples/core/ts/platform/platform.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {Component, createPlatformFactory} from '@angular/core';
1010
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
1111

1212
// #docregion longform
13-
@Component({selector: 'my-app', template: 'Hello World'})
13+
@Component({selector: 'app-root', template: 'Hello World'})
1414
class MyApp {
1515
}
1616

packages/private/testing/src/render3.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {ɵresetJitOptions as resetJitOptions} from '@angular/core';
2424
*
2525
* ```
2626
* describe('something', () => {
27-
* it('should do something', withBody('<my-app></my-app>', async () => {
27+
* it('should do something', withBody('<app-root></app-root>', async () => {
2828
* const myApp = renderComponent(MyApp);
2929
* await whenRendered(myApp);
3030
* expect(getRenderedText(myApp)).toEqual('Hello World!');

0 commit comments

Comments
 (0)