Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Actually I want to place some buttons at the bottom of screen and I want that when i choose 'suspension assembly' some specific buttons should be displayed and when I choose other option such as 'arm assembly' some other buttons should be displayed and the previous one should hide.
Also when i switch window, operation done by the previous button should be disabled.
I am not from coding background so it will be of great help if anyone can provide code for it.
Solved! Go to Solution.
Hi @manojpandey ,
I think to work your project you need to correct your code to:
...
$scope.my_json = [
{
display: "Suspension Assembly",
value: "app/resources/Uploaded/Suspension_Low.pvz"
},
{
display: "Arm Assembly",
value: "app/resources/Uploaded/Arm_Assembly_Low.pvz"
},
{
display: "Front Hub Assembly",
value: "app/resources/Uploaded/Front_Hub_Low.pvz"
}
];
...
$scope.$on('$ionicView.afterEnter', function() {$scope.populateModelList();}); $scope.checkSequence = function(){ var sequenceValue= $scope.app.view['Home'].wdg['select-1']['value']; var sequenceList = $scope.app.view['Home'].wdg['select-1']['list']; for (i = 0; i < sequenceList.length; i++){ var sequence = sequenceList[i]['value']; if (sequence == sequenceValue){ switch(i){ case 0: $scope.setWidgetProp('3DLabel-1','visible', true); $scope.setWidgetProp('3DImage-1','visible', false); $scope.setWidgetProp('3DImage-2','visible', false); break; case 1: $scope.setWidgetProp('3DImage-1','visible', true); $scope.setWidgetProp('3DLabel-1','visible', false); $scope.setWidgetProp('3DImage-2','visible', false); break; case 2: $scope.setWidgetProp('3DImage-2','visible', true); $scope.setWidgetProp('3DLabel-1','visible', false); $scope.setWidgetProp('3DImage-1','visible', false); break; default: console.log('in show/hide images'); } } } }
So in the Json definiton used for the list was the key 'value' but you used 'val' instead which was not correct
Hi @manojpandey ,
I think to work your project you need to correct your code to:
...
$scope.my_json = [
{
display: "Suspension Assembly",
value: "app/resources/Uploaded/Suspension_Low.pvz"
},
{
display: "Arm Assembly",
value: "app/resources/Uploaded/Arm_Assembly_Low.pvz"
},
{
display: "Front Hub Assembly",
value: "app/resources/Uploaded/Front_Hub_Low.pvz"
}
];
...
$scope.$on('$ionicView.afterEnter', function() {$scope.populateModelList();}); $scope.checkSequence = function(){ var sequenceValue= $scope.app.view['Home'].wdg['select-1']['value']; var sequenceList = $scope.app.view['Home'].wdg['select-1']['list']; for (i = 0; i < sequenceList.length; i++){ var sequence = sequenceList[i]['value']; if (sequence == sequenceValue){ switch(i){ case 0: $scope.setWidgetProp('3DLabel-1','visible', true); $scope.setWidgetProp('3DImage-1','visible', false); $scope.setWidgetProp('3DImage-2','visible', false); break; case 1: $scope.setWidgetProp('3DImage-1','visible', true); $scope.setWidgetProp('3DLabel-1','visible', false); $scope.setWidgetProp('3DImage-2','visible', false); break; case 2: $scope.setWidgetProp('3DImage-2','visible', true); $scope.setWidgetProp('3DLabel-1','visible', false); $scope.setWidgetProp('3DImage-1','visible', false); break; default: console.log('in show/hide images'); } } } }
So in the Json definiton used for the list was the key 'value' but you used 'val' instead which was not correct
Thanks man!!
This is what i needed