Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hidden] does not work on any elements including class="glyphicon" #193

Closed
hongbo-miao opened this issue Feb 15, 2016 · 7 comments
Closed

Comments

@hongbo-miao
Copy link
Contributor

I am not sure I should report here or Angular 2 github. Let me know if this is not the place to report. Thanks

[hidden] does not work on any elements including class="glyphicon".

This cannot hide, so not works
<span [hidden]="true" class="glyphicon glyphicon-plus-sign"></span>

This can hide, works well
<span [hidden]="true">test</span>

@hongbo-miao hongbo-miao changed the title [hidden] does not work on any elements including class="glyphicon" [hidden] does not work on any elements including class="glyphicon" Feb 15, 2016
@hongbo-miao
Copy link
Contributor Author

[hidden] also does not work on any elements including class="help-block".

<div class="form-group" [ngClass]="{'has-error':nameHasError}">
    <label class="control-label" for="name">Name</label>
    <input type="text" id="name" [(ngModel)]="name" class="form-control input-sm"/>
    <span class="help-block" [hidden]="!nameHasError">Please input your name.</span>
</div>

@hongbo-miao
Copy link
Contributor Author

Refer to angular/angular#7300

@valorkin
Copy link
Member

@hongbo-miao can not hide? add *ngIf
why not?

@hongbo-miao
Copy link
Contributor Author

@valorkin Because I read from here..

It's important to know the difference between the hidden attribute and ngIf directive. While hidden shows and hides a DOM element that is already rendered, ngIf adds or removes an element from the DOM, making it both heavier and slower. It makes sense to use ngIf if the decision to show or hide some part of the UI is made during page loading.

Right now I am using a temporary way, adding this in the main.css

[hidden] {
    display: none;
}

@edinfazlic
Copy link
Contributor

I think you can also use ngClass to achieve your goal:

BS3 (hidden):
http://getbootstrap.com/css/#helper-classes-show-hide

BS4 (hidden-xs-up):
http://v4-alpha.getbootstrap.com/layout/responsive-utilities/

@hongbo-miao
Copy link
Contributor Author

@edinfazlic that is a good alternative way! thanks

@hongbo-miao
Copy link
Contributor Author

@valorkin Right now I think this is not related with ng2-bootstrap at all, it is bootstrap thing. Thanks for your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants