If it's a template-driven form, your component would have a property named
that.
E.g.
export class MyComponent {
tickersymbol:string;
// later in the code...
getQuote() {
this.myService.getQuote(this.tickerSymbol).subscribe(....);
}
}
On Tuesday, November 7, 2017 at 2:13:10 AM UTC+1, Rich Leach wrote:
>
> Hi
>
> I'm trying to build a string from a form that I will ultimately pass as a
> url for a service call.
>
> I have a hard coded string, something like '
> https://api.iextrading.com/1.0/stock/IBM/quote'
>
> ... where "IBM" will be dynamically updated with the user entered value.
>
> So in my html template I have
> <input type="text" class="form-control" [(ngModel)]="tickersymbol">
> <div>
> https://api.iextrading.com/1.0/stock/{{tickersymbol}}/quote
> </div>
>
> ...which outputs my desired string to the screen.
>
> Like I said, n00b question, but how/where would I capture the value from
> the form field and then pass it to my service?
>
> Thanks in advance,
>
> Rich
>
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.