Hello,
when I try to add a property to an Observable instance dynamically, the binding does not work correctly anymore since we migrated our app to NS 3.
For example: let's say I dynamically add an ActivityIndicator to my page like this
var
activityIndicator =
new
activityIndicatorModule.ActivityIndicator();
//bind busy property
activityIndicator.bind({
sourceProperty:
"isLoading"
,
targetProperty:
"busy"
,
twoWay:
true
}, vmModule.vmMain);
//bind visibility
activityIndicator.bind({
sourceProperty:
"isLoading"
,
targetProperty:
"visibility"
,
twoWay:
true
,
expression:
"isLoading ? 'visible' : 'collapse'"
}, vmModule.vmMain);
//set isLoading property in Observable instance for DataBinding
vmModule.vmMain.set(
"isLoading"
,
false
);
container.addChild(activityIndicator);
Now I would have to set the isLoading property in my Observable like this:
exports.vmMain = observableModule.fromObject({
isLoading:
false
});
Then the DataBinding would work correctly. The problem is, that in our use case we have a TabView with a variable count of tabs and each Tab should have an own ActivityIndicator and we have isLoading-properties depending on the TabView-index, so we have: isLoading0, isLoading 1, ... but I do not know how many there are, so that's why I try to set/init the property during the building of the TabView vmModule.vmMain.set("isLoading" + currentIndex, false);
This worked with tns-core-modules 2.5.2.
Is this just a bug or is the way I try to achieve this not supported anymore?
I added a sample project that can be found here
Note: for simplicity the sample contains only a simple page (without TabView), where one ActivityIndicator is dynamically added.
Best regards,
Marc