How to pass value from template to ts function


Ayush Gupta

Hi I have a list and can dynamically get a list of barcodes from localstorage.

component file

<div class="scan-list">
    <table *ngFor="let item of fsubList">
        <tr>
            <td><h3>Reel No: {{item.barcodeno}}</h3></td>
            <td><h3>Date: {{item.datetime}}</h3></td>
        </tr>
        <tr>
            <td><h3>Vendor: {{item.vendor}}</h3></td>
            <td class="red"><a (click)="viewdet()">View Details</a></td>
        </tr>
    </table>
</div>

So what I want to do is get a specific row value {{item.barcodeno}}after a click viewdet()and then pass it to a ts file in a function viewdet()so that I can do further things with that fetched value.

Adrita Sharma

Try it like this:

template:

<td class="red"><a (click)="viewdet(item.barcodeno)">View Details</a></td>

TS:

viewdet(barcodeNo) {
}

Related


How to pass value from MySQL to template

Cody The struct passes the value to the template type Entry struct { Name, Mes string } This function handlesHandleFunc("/", mysqlWithTempl) func mysqlWithTempl(w http.ResponseWriter, r *http.Request) { // Open database con, err := sql.Open("mymy

How to pass value from MySQL to template

Cody The struct passes the value to the template type Entry struct { Name, Mes string } This function handlesHandleFunc("/", mysqlWithTempl) func mysqlWithTempl(w http.ResponseWriter, r *http.Request) { // Open database con, err := sql.Open("mymy

How to pass value from angularjs template to controller?

Sahil Mujawar HTML code: <tr ng-repeat="x in products"> <a href="#!/{{x.product_name}}" class="button"> {{x.product_name}}</a> I just want to get this {{x.product_name}} in angularjs scope . Means, if i click any button, it should pass x.product_name

Django how to pass value from template to view

pptt I want this functionality. The user enters an email address, and it has to be passed into my views.py file somehow, so I can email the user that he has successfully registered. Here is my template file: {% extends "base.html" %} {% block content %} <sec

How to pass value from MySQL to template

Cody The struct passes the value to the template type Entry struct { Name, Mes string } This function handlesHandleFunc("/", mysqlWithTempl) func mysqlWithTempl(w http.ResponseWriter, r *http.Request) { // Open database con, err := sql.Open("mymy

How to pass value from angularjs template to controller?

Sahil Mujawar HTML code: <tr ng-repeat="x in products"> <a href="#!/{{x.product_name}}" class="button"> {{x.product_name}}</a> I just want to get this {{x.product_name}} in angularjs scope . Means, if i click any button, it should pass x.product_name

How to pass value from angularjs template to controller?

Sahil Mujawar HTML code: <tr ng-repeat="x in products"> <a href="#!/{{x.product_name}}" class="button"> {{x.product_name}}</a> I just want to get this {{x.product_name}} in angularjs scope . Means, if i click any button, it should pass x.product_name

Django how to pass value from template to view

pptt I want this functionality. The user enters an email address, and it has to be passed into my views.py file somehow, so I can email the user that he has successfully registered. Here is my template file: {% extends "base.html" %} {% block content %} <sec

How to pass value from HTML field to component ts

Hasoun GH I'm sending a value from an HTML page to a TS component without using a form, I get a build error when trying to npm run build, here is the example: I use > npm run dev or > ng build no problem, but when I build it for production it gives an error us

How to pass value from HTML field to component ts

Hasoun GH I'm sending a value from an HTML page to a TS component without using a form, I get a build error when trying to npm run build, here is the example: I use > npm run dev or > ng build no problem, but when I build it for production it gives an error us

Angular2 pass value from template to function on button click

Dedi Phuket I have an Angular2 form template with a component like this: <div class="container"> <div class="input-group"> <label> Masukkan nik </label> <input type="text" class="form-control" placeholder="Username" aria-describedby="basic-addon1" #

Angular2 pass value from template to function on button click

Dedi Phuket I have an Angular2 form template with a component like this: <div class="container"> <div class="input-group"> <label> Masukkan nik </label> <input type="text" class="form-control" placeholder="Username" aria-describedby="basic-addon1" #

Angular2 pass value from template to function on button click

Dedi Phuket I have an Angular2 form template with a component like this: <div class="container"> <div class="input-group"> <label> Masukkan nik </label> <input type="text" class="form-control" placeholder="Username" aria-describedby="basic-addon1" #

Angular2 pass value from template to function on button click

Dedi Phuket I have an Angular2 form template with a component like this: <div class="container"> <div class="input-group"> <label> Masukkan nik </label> <input type="text" class="form-control" placeholder="Username" aria-describedby="basic-addon1" #

Angular2 pass value from template to function on button click

Dedi Phuket I have an Angular2 form template with a component like this: <div class="container"> <div class="input-group"> <label> Masukkan nik </label> <input type="text" class="form-control" placeholder="Username" aria-describedby="basic-addon1" #

How to pass value from function to promise?

Joseph Holmes I have a function and I want to pass value from on to promise. For this example, I wrote a stripped down version. In the real version, promises are required and include many other features. I just included an alert as an easy way to determine if

How to pass return value from function in xTemplate?

learning rookie Suppose we have the following data: data: [{ 'D': 1 }]; Typically, we can access this data with the following code: var tpl = new Ext.XTemplate( '<tpl for=".">', '<p>{D}</p>', //returns 1 '</tpl>' ); However, if I p

How to pass value from function to promise?

Joseph Holmes I have a function and I want to pass value from on to promise. For this example, I wrote a stripped down version. In the real version, promises are required and include many other features. I just included an alert as an easy way to determine if

How to pass value from textbox to function in AngularJs?

Vishal Mahuli my HTML: <input type ="text" ng-model="contactid" > I want to pass the contactId value entered in this box to a function abc()called "Submit" button after the box .onclick What should I do? eccentric You can do this: <form ng-controller="formCtr

How to pass value to struct function from outside?

ELTE Gaussian structI have a definition in my code and I want to pass a value from "outside". Here is an example of this problem: #include <iostream> #include <string> using namespace std; int main() { struct st { static void print(int a, int b)

How to pass a value from Angular to a function

((Avraam Mavridis) I want to call a function passed fadeOut()to it that generates an index number by ng-repeat. I tried <img ng-src={{element.image}} class="portofolio-image" id="portofolio-image{{$index}}" ng-click="fadeOut({{$index}})"> But there is a

how to pass value from php to jquery function

PHPFromTheBack What I want to accomplish is to pass the correct value from php to the jquery function. What is the correct way to pass that value to my jquery function so I can use it. Here is an example of how I am trying to pass a php variable to a javascrip

How to pass value from Ajax to another function

Alam I need help understanding how to export a value from an ajax function and import it into other functions example function getlanlon(){ $.ajax({ type: "GET", url: "{{URL::to('/')}}/getlatlng",

How to pass value to struct function from outside?

ELTE Gaussian structI have a definition in my code and I want to pass a value from "outside". Here is an example of this problem: #include <iostream> #include <string> using namespace std; int main() { struct st { static void print(int a, int b)