mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
test(angular): update testapp to incude button example and global styles
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
|
||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.0.0.
|
||||
|
||||
## Development server
|
||||
## Developing
|
||||
|
||||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
|
||||
Run `npm run serve` to copy ionic and run a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ const routes: Routes = [
|
||||
{ path: 'alert', loadChildren: './alert/alert.module#AlertModule' },
|
||||
{ path: 'actionSheet', loadChildren: './action-sheet/action-sheet.module#ActionSheetModule' },
|
||||
{ path: 'badge', loadChildren: './badge/badge.module#BadgeModule' },
|
||||
{ path: 'button', loadChildren: './button/button.module#ButtonModule' },
|
||||
{ path: 'card', loadChildren: './card/card.module#CardModule' },
|
||||
{ path: 'content', loadChildren: './content/content.module#ContentModule' },
|
||||
{ path: 'toast', loadChildren: './toast/toast.module#ToastModule' },
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component, ViewChild } from '@angular/core';
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { Badge } from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
@@ -74,7 +74,7 @@ import { Badge } from '@ionic/angular';
|
||||
</ion-app>
|
||||
`
|
||||
})
|
||||
export class BadgePageComponent {
|
||||
export class BadgePageComponent implements OnInit {
|
||||
dynamicColor = 'primary';
|
||||
|
||||
@ViewChild(Badge) badge: Badge;
|
||||
|
||||
49
angular/test/testapp/src/app/button/button-page.component.ts
Normal file
49
angular/test/testapp/src/app/button/button-page.component.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { Button } from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
selector: 'app-button-page',
|
||||
template: `
|
||||
<ion-app>
|
||||
<ion-header>
|
||||
<ion-toolbar>
|
||||
<ion-title>Buttons</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
<ion-content>
|
||||
<ion-button>Default</ion-button>
|
||||
<ion-button color="primary">Primary</ion-button>
|
||||
<ion-button [color]="dynamicColor" (click)="toggleColor()">{{ dynamicColor }}</ion-button>
|
||||
|
||||
<p>
|
||||
<ion-button (click)="disableClick()" [disabled]="isDisabled">Disabled</ion-button>
|
||||
<ion-button (click)="isDisabled = !isDisabled">Toggle Disabled</ion-button>
|
||||
</p>
|
||||
</ion-content>
|
||||
</ion-app>
|
||||
`
|
||||
})
|
||||
export class ButtonPageComponent implements OnInit {
|
||||
dynamicColor = 'primary';
|
||||
isDisabled = true;
|
||||
|
||||
@ViewChild(Button) button: Button;
|
||||
|
||||
ngOnInit() {
|
||||
console.log(this.button);
|
||||
}
|
||||
|
||||
disableClick() {
|
||||
console.log('Clicked disabled button');
|
||||
}
|
||||
|
||||
toggleColor() {
|
||||
if (this.dynamicColor === 'primary') {
|
||||
this.dynamicColor = 'secondary';
|
||||
} else if (this.dynamicColor === 'secondary') {
|
||||
this.dynamicColor = 'danger';
|
||||
} else {
|
||||
this.dynamicColor = 'primary';
|
||||
}
|
||||
}
|
||||
}
|
||||
14
angular/test/testapp/src/app/button/button-routing.module.ts
Normal file
14
angular/test/testapp/src/app/button/button-routing.module.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
import { ButtonPageComponent } from './button-page.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', component: ButtonPageComponent }
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class ButtonRoutingModule { }
|
||||
16
angular/test/testapp/src/app/button/button.module.ts
Normal file
16
angular/test/testapp/src/app/button/button.module.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
import { IonicModule } from '@ionic/angular';
|
||||
import { ButtonPageComponent } from './button-page.component';
|
||||
import { ButtonRoutingModule } from './button-routing.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
ButtonRoutingModule,
|
||||
IonicModule
|
||||
],
|
||||
declarations: [ButtonPageComponent]
|
||||
})
|
||||
export class ButtonModule { }
|
||||
@@ -88,6 +88,9 @@
|
||||
<li>
|
||||
<a [routerLink]="['/badge']">Badge Page</a>
|
||||
</li>
|
||||
<li>
|
||||
<a [routerLink]="['/button']">Button Page</a>
|
||||
</li>
|
||||
<li>
|
||||
<a [routerLink]="['/card']">Card Page</a>
|
||||
</li>
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||
|
||||
<link rel="stylesheet" href="https://unpkg.com/@ionic/core/css/ionic.min.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<app-root></app-root>
|
||||
|
||||
@@ -14,11 +14,10 @@
|
||||
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
* BROWSER POLYFILLS
|
||||
*/
|
||||
// BROWSER POLYFILLS
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
||||
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
|
||||
// IE9, IE10 and IE11 requires all of the following polyfills.
|
||||
// import 'core-js/es6/symbol';
|
||||
// import 'core-js/es6/object';
|
||||
// import 'core-js/es6/function';
|
||||
@@ -40,41 +39,26 @@
|
||||
/** IE10 and IE11 requires the following for the Reflect API. */
|
||||
// import 'core-js/es6/reflect';
|
||||
|
||||
|
||||
/** Evergreen browsers require these. **/
|
||||
// Evergreen browsers require these.
|
||||
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
|
||||
import 'core-js/es7/reflect';
|
||||
|
||||
|
||||
/**
|
||||
* Web Animations `@angular/platform-browser/animations`
|
||||
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
|
||||
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
|
||||
**/
|
||||
// Required to support Web Animations `@angular/platform-browser/animations`.
|
||||
// Needed for: All but Chrome, Firefox and Opera. https://caniuse.com/#feat=web-animation
|
||||
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
||||
|
||||
// Zone JS is required by Angular itself.
|
||||
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
||||
|
||||
// APPLICATION IMPORTS
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* By default, zone.js will patch all possible macroTask and DomEvents
|
||||
* user can disable parts of macroTask/DomEvents patch by setting following flags
|
||||
* Date, currency, decimal and percent pipes.
|
||||
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
|
||||
*/
|
||||
|
||||
// (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
||||
// (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
||||
// (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
||||
|
||||
/*
|
||||
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
|
||||
* with the following flag, it will bypass `zone.js` patch for IE/Edge
|
||||
*/
|
||||
// (window as any).__Zone_enable_cross_context_check = true;
|
||||
|
||||
/***************************************************************************************************
|
||||
* Zone JS is required by default for Angular itself.
|
||||
*/
|
||||
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
||||
|
||||
|
||||
|
||||
/***************************************************************************************************
|
||||
* APPLICATION IMPORTS
|
||||
// import 'intl'; // Run `npm install --save intl`.
|
||||
/**
|
||||
* Need to import at least one locale-data with intl.
|
||||
*/
|
||||
// import 'intl/locale-data/jsonp/en';
|
||||
|
||||
Reference in New Issue
Block a user