These are chat archives for angular/angular-2-ionic-2

22nd
Nov 2016
Andrew Graham-Yooll
@andrewgy8
Nov 22 2016 10:00
Does ngOnChanges not work in Ionic2 rc-2?
I have this code ngOnChanges(){ if(!this.isLoading){ this.iaReportstoDiscussedTopics = this.mapIaReportToDiscussedTopics(); } } in one of my components and on build it shoots me an error.
[10:53:05] Supplied parameters do not match any signature of call target.
[10:53:05] Error at
/.tmp/components/iareports/iareports-list.component.ngfactory.ts:70:7
If I go into the .tmp file, i get a red squiggly below the .ngOnChanges and when i hover it says "Property 'ngOnChanges' does not exist on type 'IaReportsListComponent'."
Andrew Graham-Yooll
@andrewgy8
Nov 22 2016 10:21
Just to answer my own question, if you use ngOnChanges it must have a parameter. ngOnChanges(changes){ if(!this.isLoading){ this.iaReportstoDiscussedTopics = this.mapIaReportToDiscussedTopics(); } }
Alberto Margarido
@diveintechCom_twitter
Nov 22 2016 10:32
Im heaving problem to read the JSON below. It turns out like object and I get an error: Cannot find a differ supporting object '[object Object]. I found angular/angular#6392 but not working yet since Im new to the language.
{
  "1": {
    "lat": "43.11729231328086",
    "lng": "131.895605550293",
    "img4": "http://city1.wpmix.net/wp-content/uploads/bfi_thumb/16-mpr1u7pnwxg8mtfdbmfi1nakepztv4ieqaboomb3ow.jpg",
    "permalink": "http://city1.wpmix.net/places/breeze-all-day-bar/",
    "except": " \r\n\r\nBar. Raise your glass and your spirits. The All Day Bar isn\\'t just for nights. It\\'s for every day and happy hours, too. We invite you to try a spirited cocktail in our bar.",
    "title": "Breeze All Day Bar",
    "commentscount": 1,
    "instagramfeed": "http://city1.wpmix.net/wp-admin/admin-ajax.php?action=mycity_get_insta&id=7887",
    "adress": "Корабельная наб., 1, Владивосток, Приморский край, Россия, 690091",
    "phone": "",
    "likes": 0,
    "fmr_icon": [
      {
        "icon_url": "http://city1.wpmix.net/fmr_icon_PNG/532.png",
        "title": " After Party"
      },
      {
        "icon_url": "",
        "title": ""
      }
    ],
    "catid": 305,
    "caticon": "http://city1.wpmix.net/wp-content/uploads/305.png",
    "cattitle": "Day bar",
    "caticon2": "http://city1.wpmix.net/fa-icon_PNG/cafe.png"
  },
  "2": {
    "lat": "43.1194565",
    "lng": "131.88440779999996",
    "img4": "http://city1.wpmix.net/wp-content/uploads/bfi_thumb/stock-photo-night-club-party-crowd-hands-up-2802235701-mpb3m618diz734q7k0m9u5z52rvqwdx395lrrkyhkg.jpg",
    "permalink": "http://city1.wpmix.net/places/happy-night-bar/",
    "except": " \r\n\r\nnight bars and pubs stay open after midnight and are ideal for drinking after hours, especially once the 24-hour night tube begins.\r\n",
    "title": "Happy night bar",
    "commentscount": 3,
    "instagramfeed": "",
    "adress": "ул. Мордовцева, 1, Владивосток, Приморский край, Россия, 690091",
    "phone": "",
    "likes": 0,
    "fmr_icon": [
      {
        "icon_url": "http://city1.wpmix.net/fmr_icon_PNG/426.png",
        "title": "Girl inside ;)"
      },
      {
        "icon_url": "",
        "title": ""
      }
    ],
    "catid": 304,
    "caticon": "http://city1.wpmix.net/wp-content/uploads/304.png",
    "cattitle": "Night bar",
    "caticon2": "http://city1.wpmix.net/fmr_icon_PNG/38.png"
  }
}
Alberto Margarido
@diveintechCom_twitter
Nov 22 2016 13:32
Andrew Graham-Yooll
@andrewgy8
Nov 22 2016 16:21
@diveintechCom_twitter Can you give us a small example of your code? Angular does not display an object. You have to tell it what data to display.
Nick
@ncapito
Nov 22 2016 19:47
Having an issue right now with my ionic 2 serve command. I have something cached that I can't seem to clear. Every time it live refreshes it has old data. I have to do a hard refresh and then it will work. I went into dev tools and cleared the application cache data but it didnt fix it. I have tried disabling service workers (but it still is happening). Any suggestions ?
Nick
@ncapito
Nov 22 2016 20:01
It looks like everything is coming from service worker but I have it set to Update on reload.
Alberto Margarido
@diveintechCom_twitter
Nov 22 2016 20:41

Hi @andrewgy8 ! For now, just a pipe is working for what I need.

import { Injectable, Pipe } from '@angular/core';


@Pipe({
  name: 'keyspipe'
})
@Injectable()
export class KeysPipe {


      transform(value: any, args?: any[]): any[] {
          // we'll put our functional code in here...

          console.log('KeysPipe....');

          let keyArr: any[] = Object.keys(value),
                     dataArr = [];

                 // loop through the object,
                 // pushing values to the return array
                 keyArr.forEach((key: any) => {
                     dataArr.push(value[key]);
                 });

                 // return the resulting array
                 return dataArr;

      }
}

On the template:

<li *ngFor="let post of (redditService.posts | keyspipe) ">{{post.lat}}</li>