another technical blog...technically

Monday, April 8, 2019

BP and Angular

Working with Antonio (Durante ndr), we faced a problem automating modern web application written in Angular.
Let me explain you the scenario, we spied all the textboxes with HTML spy mode and we wrote values into the textboxes, but the system returned an error.
I cannot show you anything else because... come on you know why, but focus on the red border and trust me that the message showed by the system is: please enter a value.

And the system said: please enter a value

Why this happened?
Simply because, even if we wrote something, the ng-pristine tag is still here.
What is ng-pristine? A tag that tells the model that no fields has been modified.

How to solve this problem? Convince Angular you did something on the interface.
In the example below, we wrote the value 7200 in the field with name agenziaOrdinante.
After that we force angular to call the change event and then the blur event, in this way we notify to the model that something has changed, with the blur event indeed we are sure to trigger other potential events that are fired when we click elsewhere.

JS = lifesaver
In the end mind to create a VBO that writes data using JS to generate and launch the javascripts one by one.
Instead of ElementName input, in the final version i preferred to use JS selector as input to make the code more generic.

Write data action example
And that's all folks. As usual thanks to Antonio Durante for the fun trip.
written in: Milano MI, Italia

0 commenti:

Post a Comment

Because of a lot of SPAM about courses, I need to moderate all comments here.
I ensure you that I will answer whenever possible (if you are not a spammer).

Me, myself and I

My Photo
I'm just another IT guy sharing his knowledge with all of you out there.
Wanna know more?