Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

174
Views
Update ng-if variable from ts file

In my angularjs app written with typescript, I am trying to add an asterisk to a certain field in the html using ng-if

<td class="abc" >                    
    <span ng-if="vm.showStar == true && vm.Id == myItem.Id">{{myitem.myValue}}*</span>
    <span ng-if="vm.showStar != true">{{myitem.myValue}}</span>
  </span>
</td>

In the ts file, I have what is i guess a javascript function to which i am passing the rootscope in order to capture the event emitted from elsewhere.

function myCtrlr(

  $rootScope,

  ...
  $rootScope.$on('myEvent', function(event,data) {
    debugger;
    console.log(event);
    vm.showStar = true;    
});

The event is captured successfuly

In the ts file, There is also an interface which contains variables. The interface and javascript function are linked using a line like this:

export default angular.module('myapp.controller.hourlyCheck', requires)
  .controller('MyCheckCtrl', myCtrlr)
  .name;

But when the event comes in it is not updating the variable showStar in the html. How can I get it to update?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!