robcaa
robcaa

Reputation: 191

Nativescript: How to create SegmentBar in xml not programmatically?

This is not working:

<SegmentedBar>
    <SegmentedBarItem title="First"></SegmentedBarItem>
    <SegmentedBarItem title="Second"></SegmentedBarItem>
</SegmentedBar>

I get this error message:

Uncaught (in promise): Error in ...html caused by cannot read property 'newTabSpec' of undefined.

It looks like this is a system bug.

Nativescript version: 2.4.0

Upvotes: 1

Views: 107

Answers (1)

Vladimir Amiorkov
Vladimir Amiorkov

Reputation: 2921

It looks like you are trying to use the {N} + Angular declaration of the SegmentedBar in a non Angular application. Simply follow this guide from the official documentation which should both code behind and XML declaration. For example like this:

<SegmentedBar>
  <SegmentedBar.items>
    <SegmentedBarItem title="Item 1" />
    <SegmentedBarItem title="Item 2" />
    <SegmentedBarItem title="Item 3" />
  </SegmentedBar.items>
</SegmentedBar>

Upvotes: 1

Related Questions