This repository has been archived by the owner on May 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add components to the AngularDart template, and generally improve the…
… template (#357) * Add material components to AngularDart template * Clean up the template * Add the two most common meta tags: * charset for server compatibility (<1% issue) * viewport for better scaling on mobile * Tighten dependencies * Apply dartfmt and sort * Apply dartfmt to annotations, remove unused attribute * Show more best practices: * Put anything non-trivial into its own component. * Components in separate directories. * Use #references and @ViewChild to simplify code. * Call components’ functions. * Put CSS as close to its use as possible. * Use trailing commas to simplify moving code around.
- Loading branch information
Showing
9 changed files
with
159 additions
and
22 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 |
---|---|---|
@@ -1,3 +1,8 @@ | ||
:host { | ||
font-family: Roboto, Helvetica, Arial, sans-serif; | ||
/* This is equivalent of the 'body' selector of a page. */ | ||
} | ||
|
||
.blue { | ||
background-color: #2196F3; | ||
color: white; | ||
} |
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 +1,17 @@ | ||
<h1>My First Angular 2 App</h1> | ||
<h1>My First AngularDart App</h1> | ||
|
||
<material-input #myInput | ||
label="Your name" | ||
floatingLabel | ||
autoFocus> | ||
</material-input> | ||
|
||
<material-button raised | ||
(trigger)="myDialog.open()" | ||
class="blue"> | ||
Say Hello | ||
</material-button> | ||
|
||
<hello-dialog #myDialog | ||
[name]="myInput.inputText"> | ||
</hello-dialog> |
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,3 @@ | ||
a { | ||
text-decoration: none; | ||
} |
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 @@ | ||
// Copyright (c) __year__, __author__. All rights reserved. Use of this source code | ||
// is governed by a BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'package:angular2/core.dart'; | ||
import 'package:angular2_components/angular2_components.dart'; | ||
|
||
@Component( | ||
selector: 'hello-dialog', | ||
styleUrls: const ['hello_dialog.css'], | ||
templateUrl: 'hello_dialog.html', | ||
directives: const [materialDirectives], | ||
providers: const [materialProviders], | ||
) | ||
class HelloDialog { | ||
/// Modal component that hosts the inner MaterialDialog in a centered overlay. | ||
@ViewChild('wrappingModal') | ||
ModalComponent wrappingModal; | ||
|
||
/// Name of user. | ||
@Input() | ||
String name = ""; | ||
|
||
/// Opens the dialog. | ||
void open() { | ||
wrappingModal.open(); | ||
} | ||
} |
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 @@ | ||
<modal #wrappingModal> | ||
<material-dialog> | ||
|
||
<h3 header> | ||
Hello, {{ name == '' ? 'mysterious stranger' : name }}! | ||
</h3> | ||
|
||
<p> | ||
Continue your journey on | ||
<a href="https://webdev.dartlang.org/angular">webdev.dartlang.org/angular</a>. | ||
</p> | ||
|
||
<div footer> | ||
<material-button autoFocus | ||
clear-size | ||
(trigger)="wrappingModal.close()"> | ||
Close | ||
</material-button> | ||
</div> | ||
</material-dialog> | ||
</modal> |
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