Also try not using self as reference to this, i had an incopatibility issue before where self already was a property in that context, so it could collide and generate unexpected behavior.
Also with the ES6 new ‘fat arrow functions’ you don’t need that kind of things any more, you can now just keep using this.
ORIGINAL EXCEPTION: Component ‘NewPostPage’ must have either ‘template’, ‘templateUrl’, or ‘@View’ set.
ORIGINAL STACKTRACE:
Error: Component ‘NewPostPage’ must have either ‘template’, ‘templateUrl’, or ‘@View’ set.
Async accepts either a Promise or an Observable, so passing it a string won’t work, you want a placeholder while the async stuff is done right?
In that case try making an observable which the first next is the placeholder and the next one is the returned by imagePick, i think you could just make the array with the just operator for the placeholder and use from with the promise, then use flatMap operator to join them in one Observable or something like that,
Maybe can also use the Subject class instead, with the first call to next in the constructor and the next just above of the resolve of the promise.
The Promise is the one of ES6, the basic one of the new spec, the Observable from Rxjs could be more challenging to understand, basically you need to put a Promise in thumbnail that resolves later to the image source you want.
Basically you could call instead of thumbnail the function imagePick() since it returns a promise and it resolves to the image source.
I went through the Promise and Observable document. But sill have no clue how to solve my issue. I can simplify my imagePick function and even run inside zone.run(), but my problem is still there. I tried a few methods and even change my cordova image pick plugin. Here is one of my method by using image base64 data instead of url:
It could be an issue with ionic2 or the version you have. It is still in beta. Or maybe try using src="{{ something here.}}". I wouldn’t use the [src] because that is view to the code. {{ }} is more of a code to the view. Maybe that is you problem???
PS: That use of lambda DOES make a huge difference on readability.
{{ }}: interpolation: code => view
[ ]: property binding: view => code
[(ngModel)]: pretty much goes both way. Dont know how Angular2 calls it: code <==> view
Same result. But it will work if I update thumbnail outside the camera callback function. So the issue is definitely related to the getPicture callback.