how to bind a function of hard code value of drop down option using angular 2/4/5




Asked on October 21, 2018
how to bind a function of hard code value of drop down option using
angular 2/4/5.
i want to bind this function with option value.

function in abc.ts file

function compareToSort(ob1,ob2) {
  if (ob1.name < ob2.name)
    return -1;
  if (ob1.name > ob2.name)
    return 1;
  return 0;
}

<select id="sort-by" name="sort">
<option>Name(A to Z)</option>
<option>Name(Z to A)</option>
<option>Category(A to Z)</option>
<option>Category(Z to A)</option>
</select>
for Reference= https://www.concretepage.com/questions/621


Write Answer











©2024 concretepage.com | Privacy Policy | Contact Us