Tuesday, July 26, 2016

NativeScript + Angular 2: How to fix TNSLabel error

When using NativeScript + Angular 2, some strange errors may occur as Angular 2 is in RC and has many issues yet. Therefore some strange errors occur.

I've encountered such error while running my app in iOS emulator:


CONSOLE ERROR file:///app/tns_modules/zone.js/dist/zone-node.js:419:27: Unhandled Promise rejection: Can't find variable: TNSLabel ; Zone: angular ; Task: Promise.then ; Value: ReferenceError: Can't find variable: TNSLabel

The fix is rather easy - just remove and add the iOS platform.

tns platform remove ios
tns platform add ios

 Run your app again and you're all set!

No comments: