- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2018 04:00 AM
When the button is clicked, i want the value to change from 0 to 1. I can do this on client script, but its not working on server script.
HTML :
<button ng-click="c.data.getcc()">
search
</button>
<span>{{c.data.cc}}</span>
SERVER SCRIPT :
data.cc = 0;
function getcc(){
data.cc++;
}
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2018 06:13 AM
Fixed it, but it only counts to 1 , once.
client:
function()
{
var c = this;
c.open = function()
{
c.server.update();
}
}
server:
(function()
{
data.count=0;
if(input)
{
data.count++;
}
})();
i will find out why it doesnt count more than once. thank you for the help 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2018 05:30 AM
Hi Carol,
Try this code :-
HTML:-
<div>
<button class = "btn btn-success" ng-click="c.open()">Search</button>
{{data.count}}
</div>
Client Script:-
function()
{
var c = this;
c.open = function()
{
c.data.OpenBtn = "true";
c.server.update();
}
}
Server Script:-
(function()
{
data.count=0;
if(input.OpenBtn == "true")
{
data.count++;
}
})();
Let me know if you have any questions.
Please mark it Correct or Helpful, if it works based on impact....!!!!
Warm Regards,
Priyanka
www.dxsherpa.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2018 06:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2018 06:13 AM
Fixed it, but it only counts to 1 , once.
client:
function()
{
var c = this;
c.open = function()
{
c.server.update();
}
}
server:
(function()
{
data.count=0;
if(input)
{
data.count++;
}
})();
i will find out why it doesnt count more than once. thank you for the help 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2018 06:46 AM
Trying My Best:
Because as per the execution order server loads first,
and
1 it shows the value 1 after data.count++ .
2 then again you try to click on button again it loaded using c.server.update() so you are getting same value again instead of increment.
and it is not showing incremented value.
Regards,
Varsha.