Update JSON attribute after scope variable update

BarakatAli

I have the following JSON array in my controlle

$scope.companyExcelColumns = [
  {
    label: 'Name', checked: true, disabled: true, id:'nameExcel'
  },
  {
    label: 'value', checked: true, disabled: $scope.records > 1000 ? true : false, id: 'valueExcel'
  }
];

Initially the $scope.records is 0, later on it is changing but the the disabled attribute is not updating, is there a workaround ?

Thanks

bahadir

this is not a common angular question but rather a programming question. of course value of disabled will not change. it is calculated once and done for.

You could use $watch and watch changes on $scope.records object. when this object changes you can reassign value of disabled.

$scope.$watch('records', function(){ disabled = $scope.records.length > 1000})

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Update parent scope variable in AngularJS

From Java

AngularJS directive does not update on scope variable changes

From Dev

How do I update an angularjs page after a scope update?

From Dev

How to update scope model after operating the filters?

From Dev

Update scope value after dynamically update textbox

From Dev

AngularJS how to dynamically update part of scope with variable

From Dev

AngularJS binding variable outside of scope and notify update?

From Dev

$scope variable not update within $rootScope.$on

From Dev

Angular - save scope value to variable, but not update it when scope updates

From Dev

$scope variable does not update within $interval function

From Dev

How to detect attribute changes after update

From Dev

Update inner attribute of JSON with jq

From Dev

Controller $scope attribute does not update (socket connection)

From Dev

angular update $scope variable inside loop

From Dev

Update an attribute of the Active Record using a variable

From Dev

after_update callback won't update attribute

From Dev

Angular $scope not binding to view after update, navigation and $scope.$apply()

From Dev

Angular JS how to update scope variable inside another scope variable

From Dev

AngularJS : directive does not update scope after $http response in parent scope

From Dev

angular watch - update variable outside function scope

From Dev

How to update attribute value in CoreData after inserting it

From Dev

AngularJS binding variable outside of scope and notify update?

From Dev

Angularjs Update Scope variable within setTimeout not working

From Dev

Update angularJs directive scope variable on change parent scope

From Dev

How to update $scope variable value in AngularJs

From Dev

after_update callback won't update attribute

From Dev

Angular $scope not binding to view after update, navigation and $scope.$apply()

From Dev

how to continuously watch for scope variable until update

From Dev

AngularJS directive scope variable doesnt update after reopening the window

Related Related

  1. 1

    Update parent scope variable in AngularJS

  2. 2

    AngularJS directive does not update on scope variable changes

  3. 3

    How do I update an angularjs page after a scope update?

  4. 4

    How to update scope model after operating the filters?

  5. 5

    Update scope value after dynamically update textbox

  6. 6

    AngularJS how to dynamically update part of scope with variable

  7. 7

    AngularJS binding variable outside of scope and notify update?

  8. 8

    $scope variable not update within $rootScope.$on

  9. 9

    Angular - save scope value to variable, but not update it when scope updates

  10. 10

    $scope variable does not update within $interval function

  11. 11

    How to detect attribute changes after update

  12. 12

    Update inner attribute of JSON with jq

  13. 13

    Controller $scope attribute does not update (socket connection)

  14. 14

    angular update $scope variable inside loop

  15. 15

    Update an attribute of the Active Record using a variable

  16. 16

    after_update callback won't update attribute

  17. 17

    Angular $scope not binding to view after update, navigation and $scope.$apply()

  18. 18

    Angular JS how to update scope variable inside another scope variable

  19. 19

    AngularJS : directive does not update scope after $http response in parent scope

  20. 20

    angular watch - update variable outside function scope

  21. 21

    How to update attribute value in CoreData after inserting it

  22. 22

    AngularJS binding variable outside of scope and notify update?

  23. 23

    Angularjs Update Scope variable within setTimeout not working

  24. 24

    Update angularJs directive scope variable on change parent scope

  25. 25

    How to update $scope variable value in AngularJs

  26. 26

    after_update callback won't update attribute

  27. 27

    Angular $scope not binding to view after update, navigation and $scope.$apply()

  28. 28

    how to continuously watch for scope variable until update

  29. 29

    AngularJS directive scope variable doesnt update after reopening the window

HotTag

Archive