mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 13:32:54 +08:00
chore(build): fix demo compile errors, tslint errors
fix demo compile errors, tslint errors
This commit is contained in:
111
demos/src/segment/AppModule.ts
Normal file
111
demos/src/segment/AppModule.ts
Normal file
@ -0,0 +1,111 @@
|
||||
import { Component, NgModule } from '@angular/core';
|
||||
|
||||
import { IonicApp, IonicModule } from 'ionic-angular';
|
||||
|
||||
|
||||
@Component({
|
||||
templateUrl: 'main.html'
|
||||
})
|
||||
export class ApiDemoPage {
|
||||
appType = 'Paid';
|
||||
safari = 'Shared Links';
|
||||
weather = 'sunny';
|
||||
|
||||
apps = {
|
||||
'Paid': [
|
||||
{
|
||||
name: 'Monopoly',
|
||||
price: '$0.99'
|
||||
},
|
||||
{
|
||||
name: 'Angry Birds',
|
||||
price: '$2.99'
|
||||
}
|
||||
],
|
||||
'Free': [
|
||||
{
|
||||
name: 'Snapchat',
|
||||
price: 'GET'
|
||||
},
|
||||
{
|
||||
name: 'Instagram',
|
||||
price: 'OPEN'
|
||||
}
|
||||
],
|
||||
'Top': [
|
||||
{
|
||||
name: 'Spotify',
|
||||
price: 'OPEN'
|
||||
},
|
||||
{
|
||||
name: 'Pandora',
|
||||
price: 'GET'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
items = {
|
||||
'Bookmarks': [
|
||||
{
|
||||
name: 'Favorites',
|
||||
icon: 'ios-star-outline'
|
||||
},
|
||||
{
|
||||
name: 'History',
|
||||
icon: 'ios-clock-outline'
|
||||
}
|
||||
],
|
||||
'Reading List': [
|
||||
{
|
||||
name: 'Terms of Service',
|
||||
icon: 'create'
|
||||
},
|
||||
{
|
||||
name: 'User Guide',
|
||||
icon: 'book'
|
||||
}
|
||||
],
|
||||
'Shared Links': [
|
||||
{
|
||||
name: 'Ionic Framework',
|
||||
icon: 'ionic'
|
||||
},
|
||||
{
|
||||
name: 'Learn Angular',
|
||||
icon: 'logo-angular'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
getItems(type) {
|
||||
return this.apps[type];
|
||||
}
|
||||
|
||||
getSafariItems(type) {
|
||||
return this.items[type];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Component({
|
||||
template: '<ion-nav [root]="root"></ion-nav>'
|
||||
})
|
||||
export class ApiDemoApp {
|
||||
root = ApiDemoPage;
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
ApiDemoApp,
|
||||
ApiDemoPage
|
||||
],
|
||||
imports: [
|
||||
IonicModule.forRoot(ApiDemoApp)
|
||||
],
|
||||
bootstrap: [IonicApp],
|
||||
entryComponents: [
|
||||
ApiDemoPage
|
||||
]
|
||||
})
|
||||
export class AppModule {}
|
||||
|
75
demos/src/segment/main.html
Normal file
75
demos/src/segment/main.html
Normal file
@ -0,0 +1,75 @@
|
||||
<ion-header>
|
||||
|
||||
<ion-navbar no-border-bottom>
|
||||
<ion-title>Segment</ion-title>
|
||||
</ion-navbar>
|
||||
|
||||
<ion-toolbar no-border-top>
|
||||
<ion-segment [(ngModel)]="appType">
|
||||
<ion-segment-button value="Paid">
|
||||
Paid
|
||||
</ion-segment-button>
|
||||
<ion-segment-button value="Free">
|
||||
Free
|
||||
</ion-segment-button>
|
||||
<ion-segment-button value="Top">
|
||||
Top
|
||||
</ion-segment-button>
|
||||
</ion-segment>
|
||||
</ion-toolbar>
|
||||
|
||||
</ion-header>
|
||||
|
||||
<ion-content class="outer-content">
|
||||
<ion-list>
|
||||
<ion-list-header>{{ appType }}</ion-list-header>
|
||||
<ion-item *ngFor="let item of getItems(appType)">
|
||||
{{ item.name }}
|
||||
<button ion-button outline item-right>{{ item.price }}</button>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
|
||||
<ion-card>
|
||||
<ion-card-header>
|
||||
{{ safari }}
|
||||
</ion-card-header>
|
||||
<ion-card-content>
|
||||
<ion-segment [(ngModel)]="safari" color="dark">
|
||||
<ion-segment-button value="Bookmarks">
|
||||
<ion-icon name="book"></ion-icon>
|
||||
</ion-segment-button>
|
||||
<ion-segment-button value="Reading List">
|
||||
<ion-icon ios="ios-glasses-outline" md="md-glasses"></ion-icon>
|
||||
</ion-segment-button>
|
||||
<ion-segment-button value="Shared Links">
|
||||
<ion-icon ios="ios-at-outline" md="md-at"></ion-icon>
|
||||
</ion-segment-button>
|
||||
</ion-segment>
|
||||
<ion-list style="margin: 0" inset>
|
||||
<button ion-item *ngFor="let sItem of getSafariItems(safari)">
|
||||
<ion-icon item-left [name]="sItem.icon" color="primary"></ion-icon>
|
||||
{{ sItem.name }}
|
||||
</button>
|
||||
</ion-list>
|
||||
</ion-card-content>
|
||||
</ion-card>
|
||||
</ion-content>
|
||||
|
||||
<ion-footer>
|
||||
<ion-toolbar no-border-bottom>
|
||||
<ion-title>
|
||||
Weather: {{ weather == 'sunny' ? '96' : '77' }}°
|
||||
<ion-icon [name]="weather" color="danger"></ion-icon>
|
||||
</ion-title>
|
||||
</ion-toolbar>
|
||||
<ion-toolbar no-border-top no-border-bottom>
|
||||
<ion-segment [(ngModel)]="weather" color="danger">
|
||||
<ion-segment-button value="sunny">
|
||||
Sunny
|
||||
</ion-segment-button>
|
||||
<ion-segment-button value="rainy" checked>
|
||||
Rainy
|
||||
</ion-segment-button>
|
||||
</ion-segment>
|
||||
</ion-toolbar>
|
||||
</ion-footer>
|
Reference in New Issue
Block a user