Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8717985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:25:38+00:00 2026-06-13T06:25:38+00:00

Is it possible to know the elements old value and new value when it

  • 0

Is it possible to know the elements old value and new value when it is changed dynamically?

An example, I have a button with value 190

<button name="btn1" directiveX>190</button>

And this button will be changed dynamically by socket.io. When its changed, I need to compare these values, if the new value higher then the old value is.

Thank You!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T06:25:39+00:00Added an answer on June 13, 2026 at 6:25 am

    If you $watch the value in your scope, it will give you the old value and the new value. So your link function in the directive would look like this

    link: function(scope, element, attrs) {
             scope.$watch("foo", function(newVal, oldVal) {
               //logic based on oldVal
             }
          }
    

    And then in your HTML

    <button name="btn1" directiveX>{{foo}}</button>
    

    See http://docs.angularjs.org/api/ng.$rootScope.Scope

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to know if any of the textbox values have changed in
Say I have a list of n elements, I know there are n! possible
Possible Duplicate: Dynamically adding collapsible elements I would like to know how I could
I know it is possible to add/remove HTML elements dynamically to a web page
Possible Duplicate: Standard way to remove multiple elements from a dataframe I know in
I would like to know if it is possible for block elements, floated in
i want know if is possible, to get a specific element value of a
I am adding some elements inside a ListView, I know it is possible in
I know that I can target elements which have a specific attribute in CSS,
Is it possible to know the line-boxes a block element with inline elements inside

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.