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

Using ng-class rather than ng-if for icons #53

Open
dizda opened this issue Sep 19, 2015 · 1 comment
Open

Using ng-class rather than ng-if for icons #53

dizda opened this issue Sep 19, 2015 · 1 comment

Comments

@dizda
Copy link

dizda commented Sep 19, 2015

https://github.com/WDI-HK-8/Formidable-web/blob/master/app/assets/templates/forms/update.html#L19

            <i ng-if="category == 'text'" class="fa fa-font fa-fw contentIcon"></i>
            <i ng-if="category == 'textarea'" class="fa fa-text-height fa-fw contentIcon"></i>
            <i ng-if="category == 'dropdown'" class="fa fa-list-ul fa-fw contentIcon"></i>
            <i ng-if="category == 'checkbox'" class="fa fa-check-square-o fa-fw contentIcon"></i>
            <i ng-if="category == 'radio'" class="fa fa-dot-circle-o fa-fw contentIcon"></i>
            <i ng-if="category == 'description'" class="fa fa-align-left fa-fw contentIcon"></i>

You better use ng-class to save DOM:

<i ng-class="{'fa-font': category == 'text', 'fa-text': category == 'textarea', 'fa-list-ul': category == 'dropdown'}" class="fa fa-fw contentIcon"></i>
@raphaeldieu
Copy link
Contributor

Great suggestion! There is definitely room for refactoring. Will work on this

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

2 participants