Being new to ionic, and angularJs, please help on the following issue, where I try to load 2nd page upon ng-click event from the 1st page. I pass a parameter to the function associated to the ng-click function, where it populate data based on the parameter, and I use that data using ng-repeate on the 2nd page to render html
Plz refer codePen example, link as follows:
http://codepen.io/lgframe/pen/dPGvWv/
Its a two page TO-DO app, where 1st page display itemList and when clicked, it should display buttons on the 2nd page.
1st Page:
Display a list of two items ($scope.dataArray), which has ng-click="listitemClick($index)
-> Mr-AA ($index=0) -> Mr-BB ($index=1)
Function listitemClick($index) as follows: Based on the index, it reads data from $scope.jsonData[index]
$scope.listitemClick = function(index) {
$scope.listItemIndex = index;
var listObj = $scope.jsonData[index];
dayIndex = $scope.dayIndex;
$scope.btnNames = listObj[dayIndex];
};
2nd page:
Display buttons for the listItems of the page1.
When the listItem of page1 clicked, it pass $index(0,1 etc)to the function listItemClick()
This function, reads data from $scope.jsonData[index] and populate $scope.btnNames
Buttons are rendered using ng-repate on $scope.btnNames. With this value 2nd page should display related data, BUT it does not display any buttons. Looks like page is not getting latest value for $scope.btnNames. PLAEASE HELP ME RE-LOAD THE PAGE
On the header of this 2nd Page, I have two navigation buttons associated with function a)$scope.dayMinus() and b) $scope.dayPlus, where in these functions, I simply increment or decrease $scope.dayIndex. So, using << or >> navigation buttons, I like to see the buttons for Mon, Tue, Wed Thus, update 2nd Page buttons, when the navigation buttons clicked
Im using router with .config, 1st page1 has ui-srf for page2.html
On my local machine, I was NOT able to see the button on the 2nd page(page2.html), as page1.html may be in DOM ( I guess) prior to the listItemClick() function. I did search over the web, on force view to reload page etc, but no luck so far.
On codePen example, I put all the required code, where please twick it and help me reload the 2nd page