last day (14 days later) »
Royi Namir
14:45
Hi.
if so , so why <input ng-model="aa"/> {{aa}} works without ng-change ?
I was expecting that each keystrokes , it will be also evaluated
Ralph Wiggum
because it automatically updates when there is a keypress
in your example, you're setting
tb3 = tb1 + tb2
once before there is a value assigned to either variable
you can do {{parseInt(tb1)+ parseInt(tb2)}} just fine
Royi Namir
but even if I fill tb1 and tb2 , I still don't see tb3
Ralph Wiggum
yeah, because it's happening before there is a value assigned to them
Royi Namir
MMM I mean that even if I click numbers in tb1 and tb2 - i still dont see tb3
Ralph Wiggum
the code is executing
before
there is a value though
so tb3 will always be NaN
Royi Namir
14:51
in the first phase - yes it should be NaN becuase there are no numbers
but if later I click 1+2
and then 1+5 , then it should show me result of previous cycle....no?
Ralph Wiggum
hmm, not sure what you're asking
Royi Namir
at first it is NAN
later tb1=1
tb2=2
Ralph Wiggum
the code is executed only one time, so even if you update the value, it won't matter?
Royi Namir
-
Good.
then why does this code execute one time but this one
<input ng-model="aa"/> {{aa}}
is every key press ?
(the eval of {{}})
Ralph Wiggum
because the template "watches" for changes in the variables
Royi Namir
14:54
oh. So I need another function ( or to use ngchange or {{a+b}} in order for tb3 value to be shown
or to use watch
Ralph Wiggum
yeah
or you can just do something like this:
jsbin.com/jutoxuruko/1/edit?html,css,js,output
Royi Namir
it also works without parseInt
jsbin.com/quwaya/5/edit?html,js,output
Ok thank you for your time and help
last day (14 days later) »
all rooms
Transcript for
Oct '15
15
Oct
29
Room for Royi Namir and Ralph Wiggum
join this room
about this room
00:00
06:00
12:00
18:00
all times are UTC
site design / logo © 2024 Stack Exchange Inc;
legal
mobile