+1 example. Also check out w3Schools for some cool samples and learning https://www.w3schools.com/angular/default.asp enjoi
On Saturday, October 14, 2017 at 11:17:38 AM UTC-5, Sean Poulter wrote: > > Hey Raymond, > > I've worked with Angular 1.x for a few years. I'm pretty sure the problem > you're having is that Watir is changing the input field without and not > dispatching the input events that Angular uses to register the ng-change > handler. I've made a simple example for you on JSBin: > https://jsbin.com/guferad/edit?html,js,output > > You'll see that clicking the button and changing the text field value > doesn't change the counter. > If you fire an InputEvent on the text field after, it'll pick up and > increment as expected. While the short-term fix would be to execute > JavaScript to dispatch an event on that field, it makes sense to me to have > a discussion with the team to see if we should be mimicking the human > generated events in general. > > As you continue to work with Angular, you'll probably find more cases > where changing the DOM leads to a disconnect from Angular's data model. > > On Friday, 13 October 2017 05:43:50 UTC-4, Raymond Raymundo wrote: >> >> Yes, we are using angularJS. The method file_field.set doesn't work. as I >> mentioned the type attribute of the field is set to 'text'. And If I try to >> use text_field it just paste the path + file on the field without >> triggering the upload. Here is the HTML for the field >> >> <div class="input-group ng-pristine ng-untouched ng-invalid >> ng-invalid-required" required="" ngf-select="" ngf-change= >> "uploadResume($file)" ng-model="resume" name=" resume "> >> <input id="inputResume" class="form-control ng-pristine ng-untouched >> ng-valid" type="text" placeholder="Select a file..." ng-model=" >> resume.name"/> >> <span class="input-group-btn"> >> <button class="btn btn-default">Select File </button> >> </span> >> </div> >> >> And this is what I execute >> >> >> path = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')) >> $cv_path = path + '/archives/Sample.doc' >> @browser.text_field(id: 'inputResume').set($cv_path.to_s) >> >> >> >> >> On Wednesday, October 11, 2017 at 1:10:09 AM UTC+8, Raymond Raymundo >> wrote: >>> >>> So i'm trying to upload a file to a field that is set to readonly >>> >>> $browser.text_field(id: 'inputResume').set($cv_path.to_s) >>> >>> >>> >>> And I get error >>> >>> Watir::Exception::ObjectReadOnlyException (Watir::Exception:: >>> ObjectReadOnlyException) >>> >>> >>> Is there a way around this? >>> >>> >>> -- -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected] --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
