├── .editorconfig ├── .gitignore ├── README.md ├── config.xml ├── ionic.config.json ├── package.json ├── resources ├── android │ └── splash │ │ ├── drawable-land-hdpi-screen.png │ │ ├── drawable-land-ldpi-screen.png │ │ ├── drawable-land-mdpi-screen.png │ │ ├── drawable-land-xhdpi-screen.png │ │ ├── drawable-land-xxhdpi-screen.png │ │ ├── drawable-land-xxxhdpi-screen.png │ │ ├── drawable-port-hdpi-screen.png │ │ ├── drawable-port-ldpi-screen.png │ │ ├── drawable-port-mdpi-screen.png │ │ ├── drawable-port-xhdpi-screen.png │ │ ├── drawable-port-xxhdpi-screen.png │ │ └── drawable-port-xxxhdpi-screen.png ├── icon.png ├── ios │ └── splash │ │ ├── Default-568h@2x~iphone.png │ │ ├── Default-667h.png │ │ ├── Default-736h.png │ │ ├── Default-Landscape-736h.png │ │ ├── Default-Landscape@2x~ipad.png │ │ ├── Default-Landscape@~ipadpro.png │ │ ├── Default-Landscape~ipad.png │ │ ├── Default-Portrait@2x~ipad.png │ │ ├── Default-Portrait@~ipadpro.png │ │ ├── Default-Portrait~ipad.png │ │ ├── Default@2x~iphone.png │ │ └── Default~iphone.png └── splash.png ├── src ├── app │ ├── app.component.ts │ ├── app.html │ ├── app.module.ts │ ├── app.scss │ └── main.ts ├── components │ ├── music-card │ │ ├── music-card.html │ │ ├── music-card.module.ts │ │ ├── music-card.scss │ │ └── music-card.ts │ └── music-item │ │ ├── music-item.html │ │ ├── music-item.module.ts │ │ ├── music-item.scss │ │ └── music-item.ts ├── declarations.d.ts ├── directives │ ├── log-elm │ │ ├── log-elm.module.ts │ │ └── log-elm.ts │ └── log-evnt │ │ ├── log-evnt.module.ts │ │ └── log-evnt.ts ├── index.html ├── manifest.json ├── pages │ ├── detail │ │ ├── detail.html │ │ ├── detail.module.ts │ │ ├── detail.scss │ │ └── detail.ts │ └── home │ │ ├── home.html │ │ ├── home.module.ts │ │ ├── home.scss │ │ └── home.ts ├── pipes │ └── ms-to-mins │ │ ├── ms-to-mins.module.ts │ │ └── ms-to-mins.ts ├── providers │ └── spotify │ │ └── spotify.ts ├── service-worker.js └── theme │ └── variables.scss ├── tsconfig.json └── tslint.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs 2 | # editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | indent_style = space 8 | indent_size = 2 9 | 10 | # We recommend you to keep these unchanged 11 | end_of_line = lf 12 | charset = utf-8 13 | trim_trailing_whitespace = true 14 | insert_final_newline = true 15 | 16 | [*.md] 17 | trim_trailing_whitespace = false -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Specifies intentionally untracked files to ignore when using Git 2 | # http://git-scm.com/docs/gitignore 3 | 4 | *~ 5 | *.sw[mnpcod] 6 | *.log 7 | *.tmp 8 | *.tmp.* 9 | log.txt 10 | *.sublime-project 11 | *.sublime-workspace 12 | .vscode/ 13 | npm-debug.log* 14 | 15 | .idea/ 16 | .sass-cache/ 17 | .tmp/ 18 | .versions/ 19 | coverage/ 20 | dist/ 21 | node_modules/ 22 | tmp/ 23 | temp/ 24 | hooks/ 25 | platforms/ 26 | plugins/ 27 | plugins/android.json 28 | plugins/ios.json 29 | www/ 30 | $RECYCLE.BIN/ 31 | 32 | .DS_Store 33 | Thumbs.db 34 | UserInterfaceState.xcuserstate 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This is a starter template for [Ionic](http://ionicframework.com/docs/) projects. 2 | 3 | ## How to use this template 4 | 5 | *This template does not work on its own*. The shared files for each starter are found in the [ionic2-app-base repo](https://github.com/driftyco/ionic2-app-base). 6 | 7 | To use this template, either create a new ionic project using the ionic node.js utility, or copy the files from this repository into the [Starter App Base](https://github.com/driftyco/ionic2-app-base). 8 | 9 | ### With the Ionic CLI: 10 | 11 | Take the name after `ionic2-starter-`, and that is the name of the template to be used when using the `ionic start` command below: 12 | 13 | ```bash 14 | $ sudo npm install -g ionic cordova 15 | $ ionic start myBlank blank 16 | ``` 17 | 18 | Then, to run it, cd into `myBlank` and run: 19 | 20 | ```bash 21 | $ ionic platform add ios 22 | $ ionic run ios 23 | ``` 24 | 25 | Substitute ios for android if not on a Mac. 26 | 27 | -------------------------------------------------------------------------------- /config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | MyApp 4 | An awesome Ionic/Cordova app. 5 | Ionic Framework Team 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /ionic.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lazyLoad2-components", 3 | "app_id": "", 4 | "type": "ionic-angular" 5 | } 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lazyLoad2-components", 3 | "version": "0.0.1", 4 | "author": "Ionic Framework", 5 | "homepage": "http://ionicframework.com/", 6 | "private": true, 7 | "scripts": { 8 | "clean": "ionic-app-scripts clean", 9 | "build": "ionic-app-scripts build", 10 | "ionic:build": "ionic-app-scripts build", 11 | "ionic:serve": "ionic-app-scripts serve" 12 | }, 13 | "dependencies": { 14 | "@angular/common": "4.0.2", 15 | "@angular/compiler": "4.0.2", 16 | "@angular/compiler-cli": "4.0.2", 17 | "@angular/core": "4.0.2", 18 | "@angular/forms": "4.0.2", 19 | "@angular/http": "4.0.2", 20 | "@angular/platform-browser": "4.0.2", 21 | "@angular/platform-browser-dynamic": "4.0.2", 22 | "@ionic-native/core": "3.4.2", 23 | "@ionic-native/splash-screen": "3.4.2", 24 | "@ionic-native/status-bar": "3.4.2", 25 | "@ionic/storage": "2.0.1", 26 | "ionic-angular": "3.1.1", 27 | "ionicons": "3.0.0", 28 | "rxjs": "5.1.1", 29 | "sw-toolbox": "3.4.0", 30 | "zone.js": "^0.8.5" 31 | }, 32 | "devDependencies": { 33 | "@ionic/app-scripts": "1.3.6", 34 | "@ionic/cli-plugin-cordova": "1.0.0-rc.0-alpha.9763c377", 35 | "@ionic/cli-plugin-ionic-angular": "1.0.0-rc.0-alpha.9763c377", 36 | "typescript": "~2.2.1" 37 | }, 38 | "description": "An Ionic project" 39 | } 40 | -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-hdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/android/splash/drawable-land-hdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-ldpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/android/splash/drawable-land-ldpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-mdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/android/splash/drawable-land-mdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-xhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/android/splash/drawable-land-xhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-xxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/android/splash/drawable-land-xxhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-xxxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/android/splash/drawable-land-xxxhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-hdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/android/splash/drawable-port-hdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-ldpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/android/splash/drawable-port-ldpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-mdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/android/splash/drawable-port-mdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-xhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/android/splash/drawable-port-xhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-xxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/android/splash/drawable-port-xxhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-xxxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/android/splash/drawable-port-xxxhdpi-screen.png -------------------------------------------------------------------------------- /resources/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/icon.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-568h@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/ios/splash/Default-568h@2x~iphone.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-667h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/ios/splash/Default-667h.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-736h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/ios/splash/Default-736h.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape-736h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/ios/splash/Default-Landscape-736h.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/ios/splash/Default-Landscape@2x~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape@~ipadpro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/ios/splash/Default-Landscape@~ipadpro.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/ios/splash/Default-Landscape~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Portrait@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/ios/splash/Default-Portrait@2x~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Portrait@~ipadpro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/ios/splash/Default-Portrait@~ipadpro.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Portrait~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/ios/splash/Default-Portrait~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/ios/splash/Default@2x~iphone.png -------------------------------------------------------------------------------- /resources/ios/splash/Default~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/ios/splash/Default~iphone.png -------------------------------------------------------------------------------- /resources/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhartington/lazyLoad2-components/95ff4ab26149e0f4bcf4b589e3386422c574124f/resources/splash.png -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { Platform } from 'ionic-angular'; 3 | import { StatusBar } from '@ionic-native/status-bar'; 4 | import { SplashScreen } from '@ionic-native/splash-screen'; 5 | 6 | @Component({ 7 | templateUrl: 'app.html' 8 | }) 9 | export class MyApp { 10 | rootPage:any = 'HomePage'; 11 | 12 | constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) { 13 | platform.ready().then(() => { 14 | // Okay, so the platform is ready and our plugins are available. 15 | // Here you can do any higher level native things you might need. 16 | statusBar.styleDefault(); 17 | splashScreen.hide(); 18 | }); 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /src/app/app.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { ErrorHandler, NgModule } from '@angular/core'; 3 | import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular'; 4 | import { SplashScreen } from '@ionic-native/splash-screen'; 5 | import { StatusBar } from '@ionic-native/status-bar'; 6 | import { HttpModule } from '@angular/http'; 7 | import { MyApp } from './app.component'; 8 | import { SpotifyProvider } from '../providers/spotify/spotify'; 9 | 10 | @NgModule({ 11 | declarations: [MyApp], 12 | imports: [ 13 | BrowserModule, 14 | HttpModule, 15 | IonicModule.forRoot(MyApp) 16 | ], 17 | bootstrap: [IonicApp], 18 | entryComponents: [MyApp], 19 | providers: [ 20 | StatusBar, 21 | SplashScreen, 22 | {provide: ErrorHandler, useClass: IonicErrorHandler}, 23 | SpotifyProvider 24 | ] 25 | }) 26 | export class AppModule {} 27 | -------------------------------------------------------------------------------- /src/app/app.scss: -------------------------------------------------------------------------------- 1 | // http://ionicframework.com/docs/v2/theming/ 2 | 3 | 4 | // App Global Sass 5 | // -------------------------------------------------- 6 | // Put style rules here that you want to apply globally. These 7 | // styles are for the entire app and not just one component. 8 | // Additionally, this file can be also used as an entry point 9 | // to import other Sass files to be included in the output CSS. 10 | // 11 | // Shared Sass variables, which can be used to adjust Ionic's 12 | // default Sass variables, belong in "theme/variables.scss". 13 | // 14 | // To declare rules for a specific mode, create a child rule 15 | // for the .md, .ios, or .wp mode classes. The mode class is 16 | // automatically applied to the element in the app. 17 | -------------------------------------------------------------------------------- /src/app/main.ts: -------------------------------------------------------------------------------- 1 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 2 | 3 | import { AppModule } from './app.module'; 4 | 5 | platformBrowserDynamic().bootstrapModule(AppModule); 6 | -------------------------------------------------------------------------------- /src/components/music-card/music-card.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

{{track.name}}

5 |

by {{track.artists[0].name}}

6 |

{{track.album.name}}

7 | {{track.duration_ms | msToMins}} 8 |
9 |
-------------------------------------------------------------------------------- /src/components/music-card/music-card.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { IonicModule } from 'ionic-angular'; 3 | import { MusicCardComponent } from './music-card'; 4 | import { MsToMinsPipeModule } from '../../pipes/ms-to-mins/ms-to-mins.module' 5 | @NgModule({ 6 | declarations: [MusicCardComponent], 7 | imports: [IonicModule, MsToMinsPipeModule], 8 | exports: [MusicCardComponent] 9 | }) 10 | export class MusicCardComponentModule { } 11 | -------------------------------------------------------------------------------- /src/components/music-card/music-card.scss: -------------------------------------------------------------------------------- 1 | music-card { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/components/music-card/music-card.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input } from '@angular/core'; 2 | @Component({ 3 | selector: 'music-card', 4 | templateUrl: 'music-card.html' 5 | }) 6 | export class MusicCardComponent { 7 | @Input() track; 8 | constructor() {} 9 | } 10 | -------------------------------------------------------------------------------- /src/components/music-item/music-item.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

{{track.name}}

6 |

{{track.artists[0].name}}

7 |

{{track.album.name}}

8 | 9 | {{track.duration_ms | msToMins}} 10 | 11 |
-------------------------------------------------------------------------------- /src/components/music-item/music-item.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { IonicModule } from 'ionic-angular'; 3 | import { MusicItemComponent } from './music-item'; 4 | import { MsToMinsPipeModule } from '../../pipes/ms-to-mins/ms-to-mins.module' 5 | @NgModule({ 6 | declarations: [MusicItemComponent], 7 | imports: [IonicModule, MsToMinsPipeModule], 8 | exports: [MusicItemComponent] 9 | }) 10 | export class MusicItemComponentModule { } 11 | -------------------------------------------------------------------------------- /src/components/music-item/music-item.scss: -------------------------------------------------------------------------------- 1 | music-item { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/components/music-item/music-item.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input } from '@angular/core'; 2 | @Component({ 3 | selector: 'music-item', 4 | templateUrl: 'music-item.html' 5 | }) 6 | export class MusicItemComponent { 7 | @Input() track 8 | constructor() {} 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/declarations.d.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Declaration files are how the Typescript compiler knows about the type information(or shape) of an object. 3 | They're what make intellisense work and make Typescript know all about your code. 4 | 5 | A wildcard module is declared below to allow third party libraries to be used in an app even if they don't 6 | provide their own type declarations. 7 | 8 | To learn more about using third party libraries in an Ionic app, check out the docs here: 9 | http://ionicframework.com/docs/v2/resources/third-party-libs/ 10 | 11 | For more info on type definition files, check out the Typescript docs here: 12 | https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html 13 | */ 14 | declare module '*'; -------------------------------------------------------------------------------- /src/directives/log-elm/log-elm.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { LogElmDirective } from './log-elm'; 3 | @NgModule({ 4 | declarations: [LogElmDirective], 5 | exports: [LogElmDirective] 6 | }) 7 | export class LogElmDirectiveModule { } 8 | -------------------------------------------------------------------------------- /src/directives/log-elm/log-elm.ts: -------------------------------------------------------------------------------- 1 | import { Directive, Input } from '@angular/core'; 2 | @Directive({ 3 | selector: '[logElm]' // Attribute selector 4 | }) 5 | export class LogElmDirective { 6 | @Input() logElm 7 | constructor() {} 8 | ngAfterViewInit(){ 9 | console.log(this.logElm) 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/directives/log-evnt/log-evnt.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { LogEvntDirective } from './log-evnt'; 3 | @NgModule({ 4 | declarations: [LogEvntDirective], 5 | exports: [LogEvntDirective] 6 | }) 7 | export class LogEvntDirectiveModule { } 8 | -------------------------------------------------------------------------------- /src/directives/log-evnt/log-evnt.ts: -------------------------------------------------------------------------------- 1 | import { Directive, HostListener } from '@angular/core'; 2 | @Directive({ 3 | selector: '[logEvnt]' 4 | }) 5 | export class LogEvntDirective { 6 | constructor() { 7 | console.log('Hello LogEvntDirective Directive'); 8 | } 9 | 10 | @HostListener('click', ['$event']) 11 | onClick(event){ 12 | console.log(event) 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ionic App 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ionic", 3 | "short_name": "Ionic", 4 | "start_url": "index.html", 5 | "display": "standalone", 6 | "icons": [{ 7 | "src": "assets/imgs/logo.png", 8 | "sizes": "512x512", 9 | "type": "image/png" 10 | }], 11 | "background_color": "#4e8ef7", 12 | "theme_color": "#4e8ef7" 13 | } -------------------------------------------------------------------------------- /src/pages/detail/detail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Detail 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/pages/detail/detail.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { IonicPageModule } from 'ionic-angular'; 3 | import { DetailPage } from './detail'; 4 | import { MusicCardComponentModule } from '../../components/music-card/music-card.module' 5 | import { MsToMinsPipeModule } from '../../pipes/ms-to-mins/ms-to-mins.module' 6 | import { LogElmDirectiveModule } from '../../directives/log-elm/log-elm.module' 7 | @NgModule({ 8 | declarations: [DetailPage], 9 | imports: [ 10 | LogElmDirectiveModule, 11 | MsToMinsPipeModule, 12 | MusicCardComponentModule, 13 | IonicPageModule.forChild(DetailPage) 14 | ] 15 | }) 16 | export class DetailPageModule { } 17 | -------------------------------------------------------------------------------- /src/pages/detail/detail.scss: -------------------------------------------------------------------------------- 1 | page-detail { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/pages/detail/detail.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { IonicPage, NavParams } from 'ionic-angular'; 3 | 4 | @IonicPage() 5 | @Component({ 6 | selector: 'page-detail', 7 | templateUrl: 'detail.html', 8 | }) 9 | export class DetailPage { 10 | public song = this.navParams.get('track') 11 | constructor(public navParams: NavParams) { } 12 | } 13 | -------------------------------------------------------------------------------- /src/pages/home/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Ionic Blank 5 | 6 | 7 | 8 |
9 | 10 |
11 |
12 |
13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/pages/home/home.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { IonicPageModule } from 'ionic-angular'; 3 | import { HomePage } from './home'; 4 | import {MusicItemComponentModule} from '../../components/music-item/music-item.module' 5 | import { LogEvntDirectiveModule } from '../../directives/log-evnt/log-evnt.module' 6 | @NgModule({ 7 | declarations: [HomePage], 8 | imports: [ 9 | LogEvntDirectiveModule, 10 | MusicItemComponentModule, 11 | IonicPageModule.forChild(HomePage) 12 | ] 13 | }) 14 | export class HomePageModule { } 15 | -------------------------------------------------------------------------------- /src/pages/home/home.scss: -------------------------------------------------------------------------------- 1 | page-home { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/pages/home/home.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { NavController, IonicPage } from 'ionic-angular'; 3 | import { SpotifyProvider } from '../../providers/spotify/spotify' 4 | import { FormBuilder, Validators, FormGroup } from '@angular/forms'; 5 | @IonicPage() 6 | @Component({ 7 | selector: 'page-home', 8 | templateUrl: 'home.html' 9 | }) 10 | export class HomePage { 11 | public tracks; 12 | public searchForm: FormGroup 13 | 14 | constructor( 15 | public navCtrl: NavController, 16 | public fb: FormBuilder, 17 | public spotify: SpotifyProvider 18 | ) { 19 | this.searchForm = this.fb.group({ 20 | 'term': ['', Validators.required] 21 | }) 22 | } 23 | 24 | formSubmit(){ 25 | let term = this.searchForm.get('term').value; 26 | this.spotify.load(term).subscribe( 27 | results => this.tracks = results.tracks.items, 28 | err => this.tracks = [], 29 | 30 | ) 31 | } 32 | } -------------------------------------------------------------------------------- /src/pipes/ms-to-mins/ms-to-mins.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { MsToMinsPipe } from './ms-to-mins'; 3 | 4 | @NgModule({ 5 | declarations: [MsToMinsPipe], 6 | exports: [MsToMinsPipe] 7 | }) 8 | export class MsToMinsPipeModule { } 9 | -------------------------------------------------------------------------------- /src/pipes/ms-to-mins/ms-to-mins.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | @Pipe({ 3 | name: 'msToMins', 4 | }) 5 | export class MsToMinsPipe implements PipeTransform { 6 | transform(value?: number) { 7 | return this.durationFromMsHelper(value); 8 | } 9 | pad2(num) { 10 | if (num <= 99) { 11 | num = ('0' + num).slice(-2); 12 | } 13 | return num; 14 | } 15 | durationFromMsHelper(ms) { 16 | let x: number = ms / 1000; 17 | let seconds: number = this.pad2(Math.floor(x % 60)); 18 | x /= 60; 19 | let minutes: number = this.pad2(Math.floor(x % 60)); 20 | x /= 60; 21 | let hours: number = Math.floor(x % 24); 22 | let newHours = hours ? this.pad2(hours) + ':' : ''; 23 | return newHours + minutes + ':' + seconds; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/providers/spotify/spotify.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Http, Response } from '@angular/http'; 3 | import 'rxjs/add/operator/map'; 4 | import 'rxjs/add/operator/timeout'; 5 | import 'rxjs/add/operator/retryWhen'; 6 | import 'rxjs/add/operator/delay'; 7 | import { Observable } from 'rxjs/Observable'; 8 | @Injectable() 9 | export class SpotifyProvider { 10 | constructor(public http: Http) { } 11 | load(query): Observable { 12 | return this.http.get(`https://api.spotify.com/v1/search?q=${encodeURIComponent(query)}&limit=50&type=track`) 13 | .retryWhen(error => error.delay(500)) 14 | .timeout(5000) 15 | .map((res: Response) => res.json()); 16 | } 17 | } -------------------------------------------------------------------------------- /src/service-worker.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Check out https://googlechrome.github.io/sw-toolbox/docs/master/index.html for 3 | * more info on how to use sw-toolbox to custom configure your service worker. 4 | */ 5 | 6 | 7 | 'use strict'; 8 | importScripts('./build/sw-toolbox.js'); 9 | 10 | self.toolbox.options.cache = { 11 | name: 'ionic-cache' 12 | }; 13 | 14 | // pre-cache our key assets 15 | self.toolbox.precache( 16 | [ 17 | './build/main.js', 18 | './build/main.css', 19 | './build/polyfills.js', 20 | 'index.html', 21 | 'manifest.json' 22 | ] 23 | ); 24 | 25 | // dynamically cache any other local assets 26 | self.toolbox.router.any('/*', self.toolbox.cacheFirst); 27 | 28 | // for any other requests go to the network, cache, 29 | // and then only use that cached resource if your user goes offline 30 | self.toolbox.router.default = self.toolbox.networkFirst; -------------------------------------------------------------------------------- /src/theme/variables.scss: -------------------------------------------------------------------------------- 1 | // Ionic Variables and Theming. For more info, please see: 2 | // http://ionicframework.com/docs/v2/theming/ 3 | $font-path: "../assets/fonts"; 4 | 5 | @import "ionic.globals"; 6 | 7 | 8 | // Shared Variables 9 | // -------------------------------------------------- 10 | // To customize the look and feel of this app, you can override 11 | // the Sass variables found in Ionic's source scss files. 12 | // To view all the possible Ionic variables, see: 13 | // http://ionicframework.com/docs/v2/theming/overriding-ionic-variables/ 14 | 15 | 16 | 17 | 18 | // Named Color Variables 19 | // -------------------------------------------------- 20 | // Named colors makes it easy to reuse colors on various components. 21 | // It's highly recommended to change the default colors 22 | // to match your app's branding. Ionic uses a Sass map of 23 | // colors so you can add, rename and remove colors as needed. 24 | // The "primary" color is the only required color in the map. 25 | 26 | $colors: ( 27 | primary: #488aff, 28 | secondary: #32db64, 29 | danger: #f53d3d, 30 | light: #f4f4f4, 31 | dark: #222 32 | ); 33 | 34 | 35 | // App iOS Variables 36 | // -------------------------------------------------- 37 | // iOS only Sass variables can go here 38 | 39 | 40 | 41 | 42 | // App Material Design Variables 43 | // -------------------------------------------------- 44 | // Material Design only Sass variables can go here 45 | 46 | 47 | 48 | 49 | // App Windows Variables 50 | // -------------------------------------------------- 51 | // Windows only Sass variables can go here 52 | 53 | 54 | 55 | 56 | // App Theme 57 | // -------------------------------------------------- 58 | // Ionic apps can have different themes applied, which can 59 | // then be future customized. This import comes last 60 | // so that the above variables are used and Ionic's 61 | // default are overridden. 62 | 63 | @import "ionic.theme.default"; 64 | 65 | 66 | // Ionicons 67 | // -------------------------------------------------- 68 | // The premium icon font for Ionic. For more info, please see: 69 | // http://ionicframework.com/docs/v2/ionicons/ 70 | 71 | @import "ionic.ionicons"; 72 | 73 | 74 | // Fonts 75 | // -------------------------------------------------- 76 | 77 | @import "roboto"; 78 | @import "noto-sans"; 79 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "allowSyntheticDefaultImports": true, 4 | "declaration": false, 5 | "emitDecoratorMetadata": true, 6 | "experimentalDecorators": true, 7 | "lib": [ 8 | "dom", 9 | "es2015" 10 | ], 11 | "module": "es2015", 12 | "moduleResolution": "node", 13 | "sourceMap": true, 14 | "target": "es5" 15 | }, 16 | "include": [ 17 | "src/**/*.ts" 18 | ], 19 | "exclude": [ 20 | "node_modules" 21 | ], 22 | "compileOnSave": false, 23 | "atom": { 24 | "rewriteTsconfig": false 25 | } 26 | } -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-duplicate-variable": true, 4 | "no-unused-variable": [ 5 | true 6 | ] 7 | }, 8 | "rulesDirectory": [ 9 | "node_modules/tslint-eslint-rules/dist/rules" 10 | ] 11 | } 12 | --------------------------------------------------------------------------------