Saturday, March 4, 2017

Creating a Master/Detail app in Plunker with Ionic 2

Leave a Comment

Building on from some good standard Ionic 2 plunkers here http://plnkr.co/edit/ZsoPeE?p=preview and http://plnkr.co/edit/WBeRRJyYucLwvckjh5W7?p=preview

Can you help tweak my Master/Detail Plunker? I thought I had all the parts in place but missing something as it produces a white screen.

Here is my attempt at a Master/Detail plunk http://plnkr.co/edit/7NHIYMA3TUdd5nOkoXyF?p=preview

import { NgModule } from '@angular/core'; import { IonicApp, IonicModule } from 'ionic-angular';  import { AppComponent } from './app.component'; import { HomePage } from '../pages/home/home'; import { MasterPage } from '../pages/master/master'; import { DetailPage } from '../pages/detail/detail';  import { Sheetsu } from '../providers/sheetsu';  @NgModule({   imports: [ IonicModule.forRoot(AppComponent) ],   declarations: [ AppComponent, HomePage, MasterPage, DetailPage],   entryComponents: [ HomePage, MasterPage, DetailPage ],   bootstrap: [ IonicApp ],   providers: [ Sheetsu ] }) export class AppModule { } 

1 Answers

Answers 1

Fixed Plunker: http://plnkr.co/edit/5V36C9QHYDGBIqSIfBUl?p=preview

You had several mistakes

1) import { Sheetsu } from '../providers/sheetsu'; <- your file is called Sheetsu, with a capital S

2) Your relative paths are wrong, you've made it complicated for yourself by putting pages: 'pages', inside your config, and for example:

import { MasterPage } from '../pages/master/master';

inside HomePage should be

import { MasterPage } from '../master/master';

3) You are using "module": "commonjs", but not taking advantage of relative html urls:

templateUrl: 'pages/master/master.html', -> `templateUrl: './master.html',` 

with moduleId: module.id inside your @Component

4) Your button click return this.http.get('../assets/sheetsu.json') should be return this.http.get('./assets/sheetsu.json')

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment