Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win-pivot : What is the right way to use the on-selection-changed event? #83

Open
frenchyjef opened this issue Nov 15, 2015 · 0 comments

Comments

@frenchyjef
Copy link

Hi,

I am trying to figure out the proper way to use the on-selection-changed event of the win-pivot control. My use case is every time a pivot item is selected, I would like the on-selection-changed event to be triggered so I can execute some angular code.

In the below example, the changePivotView() function is triggered during initialization of the page and when a user clicks on a different pivot item. However, the $scope variables "selectedPivotItem" and "selectedPivotIndex" are never updated with the pivot item that is selected (the console.log always displays "null" and "2" respectively).

Any guidance?

This is the HTML code:

<win-pivot on-selection-changed="changePivotView()" selected-item="selectedPivotItem" selected-index="selectedPivotIndex">
    <win-pivot-item header="'First'"></win-pivot-item>
    <win-pivot-item header="'Second'"></win-pivot-item>
    <win-pivot-item header="'Last'"></win-pivot-item>
</win-pivot>

This is my angular code:

$scope.selectedPivotItem = null;
$scope.selectedPivotIndex = 2;

$scope.changePivotView = function changePivotView() {
     console.log($scope.selectedPivotItem);
     console.log($scope.selectedPivotIndex);
};

Thanks,
J-F

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants