Reputation: 3
I have question about the next error:
EXCEPTION: Error: Uncaught (in promise): EXCEPTION: Error in build/pages/search/search.html:17:14
ORIGINAL EXCEPTION: Cannot find a differ supporting object 'function () {
return [
{
"wrapperType": "track",
"kind": "song",
"artistId": 5869117,
"collectionId": 459904774,
"trackId": 459904911,
"artistName": "Lil Wayne",
"collectionName": "Tha Carter IV (Deluxe Edition)",
"trackName": "John (feat. Rick Ross)",
"collectionCensoredName": "Tha Carter IV (Deluxe Edition)",
"trackCensoredName": "John (feat. Rick Ross)",
"artistViewUrl": "https://itunes.apple.com/us/artist/lil-wayne/id5869117?uo=4",
"collectionViewUrl": "https://itunes.apple.com/us/album/john-feat.-rick-ross/id459904774?i=459904911&uo=4",
"trackViewUrl": "https://itunes.apple.com/us/album/john-feat.-rick-ross/id459904774?i=459904911&uo=4",
"previewUrl": "http://a1557.phobos.apple.com/us/r1000/085/Music/de/c6/37/mzm.vjfeqrjw.aac.p.m4a",
"artworkUrl30": "http://is4.mzstatic.com/image/thumb/Music/v4/c8/d2/f9/c8d2f98d-d2a8-35d0-fcd1-7adffc2560a9/source/30x30bb.jpg",
"artworkUrl60": "http://is4.mzstatic.com/image/thumb/Music/v4/c8/d2/f9/c8d2f98d-d2a8-35d0-fcd1-7adffc2560a9/source/60x60bb.jpg",
"artworkUrl100": "http://is4.mzstatic.com/image/thumb/Music/v4/c8/d2/f9/c8d2f98d-d2a8-35d0-fcd1-7adffc2560a9/source/100x100bb.jpg",
"collectionPrice": 11.99,
"trackPrice": 1.29,
"releaseDate": "2011-08-29T07:00:00Z",
"collectionExplicitness": "explicit",
"trackExplicitness": "explicit",
"discCount": 1,
"discNumber": 1,
"trackCount": 19,
"trackNumber": 9,
"trackTimeMillis": 286973,
"country": "USA",
"currency": "USD",
"primaryGenreName": "Hip-Hop/Rap",
"contentAdvisoryRating": "Explicit",
"isStreamable": true
}
];
}' of type 'function'. NgFor only supports binding to Iterables such as Arrays. ORIGINAL STACKTRACE: Error: Cannot find a differ supporting object 'function () {
return [
{
"wrapperType": "track",
"kind": "song",
"artistId": 5869117,
"collectionId": 459904774,
"trackId": 459904911,
"artistName": "Lil Wayne",
"collectionName": "Tha Carter IV (Deluxe Edition)",
"trackName": "John (feat. Rick Ross)",
"collectionCensoredName": "Tha Carter IV (Deluxe Edition)",
"trackCensoredName": "John (feat. Rick Ross)",
"artistViewUrl": "https://itunes.apple.com/us/artist/lil-wayne/id5869117?uo=4",
"collectionViewUrl": "https://itunes.apple.com/us/album/john-feat.-rick-ross/id459904774?i=459904911&uo=4",
"trackViewUrl": "https://itunes.apple.com/us/album/john-feat.-rick-ross/id459904774?i=459904911&uo=4",
"previewUrl": "http://a1557.phobos.apple.com/us/r1000/085/Music/de/c6/37/mzm.vjfeqrjw.aac.p.m4a",
"artworkUrl30": "http://is4.mzstatic.com/image/thumb/Music/v4/c8/d2/f9/c8d2f98d-d2a8-35d0-fcd1-7adffc2560a9/source/30x30bb.jpg",
"artworkUrl60": "http://is4.mzstatic.com/image/thumb/Music/v4/c8/d2/f9/c8d2f98d-d2a8-35d0-fcd1-7adffc2560a9/source/60x60bb.jpg",
"artworkUrl100": "http://is4.mzstatic.com/image/thumb/Music/v4/c8/d2/f9/c8d2f98d-d2a8-35d0-fcd1-7adffc2560a9/source/100x100bb.jpg",
"collectionPrice": 11.99,
"trackPrice": 1.29,
"releaseDate": "2011-08-29T07:00:00Z",
"collectionExplicitness": "explicit",
"trackExplicitness": "explicit",
"discCount": 1,
"discNumber": 1,
"trackCount": 19,
"trackNumber": 9,
"trackTimeMillis": 286973,
"country": "USA",
"currency": "USD",
"primaryGenreName": "Hip-Hop/Rap",
"contentAdvisoryRating": "Explicit",
"isStreamable": true
}
];
}' of type 'function'. NgFor only supports binding to Iterables such as Arrays.
at new BaseException (http://localhost:8100/build/js/app.bundle.js:1805:23)
at NgFor.set [as ngForOf] (http://localhost:8100/build/js/app.bundle.js:540:27)
at DebugAppView._View_SearchPage0.detectChangesInternal (SearchPage.template.js:143:30)
at DebugAppView.AppView.detectChanges (http://localhost:8100/build/js/app.bundle.js:29958:14)
at DebugAppView.detectChanges (http://localhost:8100/build/js/app.bundle.js:30063:44)
at DebugAppView.AppView.detectViewChildrenChanges (http://localhost:8100/build/js/app.bundle.js:29984:19)
at DebugAppView.AppView.detectChangesInternal (http://localhost:8100/build/js/app.bundle.js:29969:14)
at DebugAppView.AppView.detectChanges (http://localhost:8100/build/js/app.bundle.js:29958:14)
at DebugAppView.detectChanges (http://localhost:8100/build/js/app.bundle.js:30063:44)
at ViewRef_.detectChanges (http://localhost:8100/build/js/app.bundle.js:30401:65) ERROR CONTEXT [object Object]
This is my code:
I suppose that it has something to do with type of itemResults : any; I did place any, but still it gives me error. This is ionic 2 application with typescript and if anybody can help me on this please give me some tips.
Upvotes: 0
Views: 136
Reputation: 44659
Because you're doing this.itemResults = this.getResults;
without the parenthesis, you're assigning an object of type function to itemResults
and that's why the erros says:
Cannot find a differ supporting object 'function () { ... } of type 'function'. NgFor only supports binding to Iterables such as Arrays.
That line of code should be this.itemResults = this.getResults();
in order to execute the method and assign the result to the itemResults
property.
Upvotes: 0
Reputation: 8055
I guess you probably meant:
this.itemResults = this.getResults();//notice the paranthesis .. this is how you call the method.
You might also want to use the $onInit
method instead of the constructor
$onInit(){
this.itemResults = this.getResults();
}
The constructor should never load data or have any side effects.
Upvotes: 1