-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from brunolm/submodules-and-components
Submodules and components
- Loading branch information
Showing
15 changed files
with
170 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { LayoutComponent } from './layout/layout.component'; | ||
import { TitleComponent } from './title/title.component'; | ||
import { RouterModule } from '@angular/router'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
CommonModule, | ||
RouterModule, | ||
], | ||
exports: [ | ||
LayoutComponent, | ||
TitleComponent, | ||
], | ||
declarations: [ | ||
LayoutComponent, | ||
TitleComponent, | ||
], | ||
}) | ||
export class SharedModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<div> | ||
<h2>{{ message }}</h2> | ||
<hr /> | ||
</div> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { TitleComponent } from './title.component'; | ||
|
||
describe('TitleComponent', () => { | ||
let component: TitleComponent; | ||
let fixture: ComponentFixture<TitleComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ TitleComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(TitleComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Component, Input } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-title', | ||
templateUrl: './title.component.html', | ||
styleUrls: ['./title.component.scss'] | ||
}) | ||
export class TitleComponent { | ||
@Input() | ||
message: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<div> | ||
<p>You can use @Input to decorate a field making it accept values sent by the component props.</p> | ||
<p>For example:</p> | ||
<pre> | ||
export class TitleComponent {{ '{' }} | ||
@Input() | ||
message: string; | ||
{{ '}' }} | ||
</pre> | ||
|
||
<p>And then you can call the component passing a value for message.</p> | ||
<pre> | ||
<app-title message="Hello world" /> | ||
</pre> | ||
|
||
<app-title message="Hello world"></app-title> | ||
</div> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { InputComponent } from './input.component'; | ||
import { SharedModule } from '../../shared/shared.module'; | ||
|
||
describe('InputComponent', () => { | ||
let component: InputComponent; | ||
let fixture: ComponentFixture<InputComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ InputComponent ], | ||
imports: [SharedModule], | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(InputComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Component, Input } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-input', | ||
templateUrl: './input.component.html', | ||
styleUrls: ['./input.component.scss'] | ||
}) | ||
export class InputComponent { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
<div class="container-fluid"> | ||
<div class="Tutorials-container container-fluid"> | ||
<fieldset> | ||
<legend>TutorialsComponent</legend> | ||
<div> | ||
Tutorials | ||
<div class="row"> | ||
<div class="col-2"> | ||
<ul class="Tutorials-menu"> | ||
<li> | ||
<a routerLink="/tutorials/input" [routerLinkActive]="'active'">@Input</a> | ||
</li> | ||
</ul> | ||
</div> | ||
<div class="col-10"> | ||
<div class="container-fluid"> | ||
<router-outlet></router-outlet> | ||
</div> | ||
</div> | ||
</div> | ||
</fieldset> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.Tutorials-container fieldset { | ||
padding-top: 0; | ||
} | ||
|
||
.Tutorials-menu { | ||
background-color: #f1f1f1; | ||
list-style: none; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
.Tutorials-menu li { | ||
margin: 0; | ||
} | ||
|
||
.Tutorials-menu a { | ||
display: block; | ||
color: #000; | ||
padding: .5em; | ||
} | ||
|
||
.Tutorials-menu a.active { | ||
background-color: #4CAF50; | ||
color: #fff; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { Routes, RouterModule } from '@angular/router'; | ||
import { TutorialsComponent } from './tutorials.component'; | ||
import { InputComponent } from './input/input.component'; | ||
|
||
const routes: Routes = [ | ||
{ path: '', component: TutorialsComponent }, | ||
{ | ||
path: '', | ||
component: TutorialsComponent, | ||
children: [ | ||
{ path: 'input', component: InputComponent }, | ||
], | ||
}, | ||
]; | ||
|
||
export const TutorialsRoutingModule = RouterModule.forChild(routes); |