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!

1 comment:

for IT the said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from TypeScript Training in Chennai . or learn thru Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry. Javascript Online Training from India