-1

@angular/upgrade/static

I am trying to upgrade an AngularJS controller to Angular context using UpgradeModule from '@angular/upgrade/static'

When I change ng-show to ng-if on span or div the enclosed content does not display as expected Using the stackbliz code is easier to see the issue,

https://stackblitz.com/edit/angular-xcqzsy

Angular CLI: 7.0.6 Node: 9.5.0 OS: win32 x64 Angular: 7.0.4 npm: 5.6.0

I am trying to use use AngularJS component in Angular application, and in the issue in this markup is, the contained span block with ng-repeat does not display, If I change the ng-if on the parent div to ng-show then the inner markup appears as expected

<div ng-if="vm.showMe == 'SHOW_ME'">
  <span ng-repeat="col in vm.colCollection">
    <h4 title="{{col.appName}}">Testing: {{col.appName}}</h4>
  </span>
</div>
Payam
  • 19
  • 4
  • `ng-show` is equivalent to `[hidden]` just does the opposite. means in both cases you have elements available and hidden in DOM. ngIf takes out the element from DOM. also it is `*ngIf` in angular7 world – nircraft Dec 07 '18 at 13:22

1 Answers1

0

This will working same as ng-show.

<span ng-if="vm.allowed" ng-repeat="col in vm.colCollection">
    <h4 title="{{col.appName}}">Testing: {{col.appName}}</h4>
</span>
Noman Fareed
  • 274
  • 3
  • 11