Skip to content

Commit 53f9118

Browse files
kapunahelewongalexeagle
authored andcommitted
docs(aio): add NgModule docs (angular#20306)
PR Close angular#20306
1 parent e64b1e9 commit 53f9118

File tree

217 files changed

+3861
-2440
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

217 files changed

+3861
-2440
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"server": {
3+
"baseDir": "src",
4+
"routes": {
5+
"/node_modules": "node_modules"
6+
}
7+
}
8+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { AppPage } from './app.po';
2+
3+
describe('feature-modules App', () => {
4+
let page: AppPage;
5+
6+
beforeEach(() => {
7+
page = new AppPage();
8+
});
9+
10+
it('should display message saying app works', () => {
11+
page.navigateTo();
12+
expect(page.getParagraphText()).toEqual('app works!');
13+
});
14+
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"description": "Bootstrapping",
3+
"basePath": "src/",
4+
"files": [
5+
"!**/*.d.ts",
6+
"!**/*.js",
7+
"!**/*.[1,2].*"
8+
],
9+
"open": "app/app.component.ts",
10+
"tags": ["ngmodules"]
11+
}

aio/content/examples/bootstrapping/src/app/app.component.css

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<h1>
2+
{{title}}
3+
</h1>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { TestBed, async } from '@angular/core/testing';
2+
import { AppComponent } from './app.component';
3+
4+
describe('AppComponent', () => {
5+
beforeEach(() => {
6+
TestBed.configureTestingModule({
7+
declarations: [
8+
AppComponent
9+
],
10+
});
11+
TestBed.compileComponents();
12+
});
13+
14+
it('should create the app', async(() => {
15+
const fixture = TestBed.createComponent(AppComponent);
16+
const app = fixture.debugElement.componentInstance;
17+
expect(app).toBeTruthy();
18+
}));
19+
20+
it(`should have as title 'app works!'`, async(() => {
21+
const fixture = TestBed.createComponent(AppComponent);
22+
const app = fixture.debugElement.componentInstance;
23+
expect(app.title).toEqual('app works!');
24+
}));
25+
26+
it('should render title in a h1 tag', async(() => {
27+
const fixture = TestBed.createComponent(AppComponent);
28+
fixture.detectChanges();
29+
const compiled = fixture.debugElement.nativeElement;
30+
expect(compiled.querySelector('h1').textContent).toContain('app works!');
31+
}));
32+
});
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Component } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-root',
5+
templateUrl: './app.component.html',
6+
styleUrls: ['./app.component.css']
7+
})
8+
export class AppComponent {
9+
title = 'app works!';
10+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// #docplaster
2+
// #docregion whole-ngmodule
3+
4+
// imports
5+
import { BrowserModule } from '@angular/platform-browser';
6+
import { NgModule } from '@angular/core';
7+
import { FormsModule } from '@angular/forms';
8+
import { HttpModule } from '@angular/http';
9+
10+
import { AppComponent } from './app.component';
11+
// #docregion directive-import
12+
import { ItemDirective } from './item.directive';
13+
// #enddocregion directive-import
14+
15+
16+
// @NgModule decorator with its metadata
17+
@NgModule({
18+
// #docregion declarations
19+
declarations: [
20+
AppComponent,
21+
ItemDirective
22+
],
23+
// #enddocregion declarations
24+
imports: [
25+
BrowserModule,
26+
FormsModule,
27+
HttpModule
28+
],
29+
providers: [],
30+
bootstrap: [AppComponent]
31+
})
32+
export class AppModule { }
33+
34+
// #enddocregion whole-ngmodule
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { ItemDirective } from './item.directive';
2+
3+
describe('ItemDirective', () => {
4+
it('should create an instance', () => {
5+
const directive = new ItemDirective();
6+
expect(directive).toBeTruthy();
7+
});
8+
});

0 commit comments

Comments
 (0)