0

My angular view is not updating after changing a value in the controller via a partial. When I do a console.log it logs the changed values.

TestController

$scope.testitem = 0;

$scope.updatePagination = function(page, lastPage) {
    console.log('Test ', + page + " " + lastPage); //works
    $scope.testitem = page; //doesnt work
};

View

p(ng-model="testitem") {{testitem}} test
div(st-pagination="", st-items-by-page="displayAmount", st-displayed-pages="7", class="pagination" st-template="/partials/pagination.custom.html")

pagination.custom.html

nav(ng-if='pages.length >= 2')
ul.pagination
    li.non-clickable(ng-repeat="page in pages", ng-class="{active: page==currentPage}", ng-controller="controller")
        a( ng-click='selectPage(page); updatePagination(page, numPages)') {{page}}

1 Answer 1

1

Try the below, you may need to tell the view that there has been an update to the scope.

$scope.apply(function(){
    $scope.testitem = page; //doesnt work
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.