I want to add $ symbol in front of 10 instead of under
The result should be “under $10” Please assist.
Do you use Ionic Angular?
yes . using ionic 3 . typescript too
{{ ‘addon.jobs.pay’ | translate }}
${{ job?.rate?.replace(’-’,’-$’)}}
this is the code written.
Try to keep HTML out of controllers and JavaScript out of templates. I would format the string exactly as you want to display it in the controller:
interface WiredJob {
// whatever goes here
}
interface Job extends WiredJob {
displayRate: string;
}
this.jobService.allJobs()
.pipe(jobs => jobs.map(job => this.unwireJob(job)))
.subscribe(jobs => this.jobs = jobs);
unwireJob(wired: WiredJob): Job {
let rv: Partial<Job> = wired;
rv.displayRate = /* do your magic here */;
return rv as Job;
}
Then the template can be much cleaner: {{job.displayRate}}
.