Is there a way to change integer values in a table to actual names and display them on a webpage by setting a scope in the controller and passing that string to the HTML?
For example, this is an example of the HTML code for the table row:
<thead>
<tr>
<th>Foo</th>
</tr>
</thead>
<tbody>
<tr ng-repeat= "x in names">
<td>{{ x.bar }}</td>
</tr>
</tbody>
I am unsure about the syntax for creating a scope in Angular and then pushing it to the HTML.
The table currently displays '1' instead of 'bar'. I want it to show 'bar' but internally recognize it as '1'.
Sometimes people use something like this:
app.filter('thisfilter', function() {
return function (bar)
if((bar) || bar < 1){
return status_options;
}else{
var lastdigit = bar % 100;
if(lastdigit === 1){
return 'audi'
} else if(lastdigit === 2){
return 'bmw'
} else if(lastdigit === 3){
return 'mercedes'
} else if(last digit === 4){
return 'lexus'
}
}
}
Then they incorporate this into the HTML:
<td>{{ x.foo | thisfilter }}</td>