html declaration SegmentedBar or TabView not working
Hi,
I'm trying to use the modules SegmentedBar and/or the TabView one, but I'm struggling to make it work. It might be a misunderstanding from me, but I've been trying many operations and I never come to something consistent. In the Segmented Bar example, I have an empty view containing only the example (corrected w/o autoclosing tags compared to the example provided here).
<SegmentedBar> <SegmentedBar.items> <SegmentedBarItem title="Item 1"></SegmentedBarItem> <SegmentedBarItem title="Item 2"></SegmentedBarItem> <SegmentedBarItem title="Item 3"></SegmentedBarItem> </SegmentedBar.items> </SegmentedBar>
Note that I don't use the <Page> tag in my view.
I also added the import segmentedBarModule = require("ui/segmented-bar");
in my component.ts file.
Still, I do experience this error :
` ORIGINAL EXCEPTION: TypeError: view._inheritProperties is not a function JS: ORIGINAL STACKTRACE: JS: TypeError: view._inheritProperties is not a function JS: at ProxyViewContainer.View._propagateInheritableProperties (/data/data/org.nativescript.gpadri/files/app/tns_modules/ui/core/view-common.js:930:14) JS: at ProxyViewContainer.View._addViewCore (/data/data/org.nativescript.gpadri/files/app/tns_modules/ui/core/view-common.js:919:14) JS: at ProxyViewContainer.View._addViewCore (/data/data/org.nativescript.gpadri/files/app/tns_modules/ui/core/view.js:145:39) JS: at ProxyViewContainer.View._addView (/data/data/org.nativescript.gpadri/files/app/tns_modules/ui/core/view-common.js:914:14) JS: at ProxyViewContainer.LayoutBase.addChild (/data/data/org.nativescript.gpadri/files/app/tns_modules/ui/layouts/layout-base.js:44:14) JS: at ViewUtil.insertChild (/data/data/org.nativescript.gpadri/files/app/tns_modules/nativescript-angular/view-util.js:50:24) JS: at ViewUtil.createAndAttach (/data/data/org.nativescript.gpadri/files/app/tns_modules/nativescript-angular/view-util.js:101:18) JS: at ViewUtil.createView (/data/data/org.nativescript.gpadri/files/app/tns_modules/nativescript-angular/view-util.js:108:25) JS: at NativeScriptRenderer.createElement (/data/data/org.nativescript.gpadri/files/app/tns_modules/nativescript-angular/renderer.js:210:30) JS: at DebugAppView._View_OrganisationPage0.createInternal (OrganisationPage.template.js:46:31) JS: ERROR CONTEXT: JS: [object Object]
`
I do belive that it comes from the <SegmentedBar.items> , but I don't have any clue for solving this.
Any insight ?
Indeed the problem is with nested items property. This scenario is not supported in angular scenario.
For an inside reference how to use SegmentedBar inside Angular you can use this example - ts and html.
If you don't want to use a binding, you can still define the items in markup, but you need to get rid of the SegmentedBar.items tag:
<SegmentedBar>
<SegmentedBarItem title="Item 1"></SegmentedBarItem>
<SegmentedBarItem title="Item 2"></SegmentedBarItem>
</SegmentedBar>
Just to review your comment @hdeshev, using this markup sadly doesn't currently work, but the first one provided by @nsndeck does. Thanks for your answers 👍 👍