ng-class button stops working after using its activator with a link

user2537154

I have this

  body
    div(ng-class="toggle ? 'nav-open' : 'nav'")
      .container
        .logo
          img(src='images/logo.png')
          span Motto
        ul(ng-class="toggle ? 'menu-open' : 'menu'")
          li
            a(href="#!/", ng-click='toggle = !toggle') Home
          li
            a(href="#!/products", ng-click='toggle = !toggle') Products

activated first by this

  button.upon(type="button", ng-click='toggle = !toggle') Menu

and you see it closes clickin on a link. The problem is that when I close it by a click it doesnt' work anymore, must refresh the page in order to do it, and using this while on mobile it just closes without changing the page. What am I doing wrong and/or is there any better way to achieve what I'm doin?

Jon Quarfoth

Check out some of the examples in the docs - there's a few different ways to use ngClass. https://docs.angularjs.org/api/ng/directive/ngClass

I think this syntax should probably work for your case:

ng-class="{'nav-open': toggle, 'nav': !toggle}"

ng-class="{'menu-open': toggle, 'menu': !toggle}"

Essentially you're providing ngClass with a configuration object that says: "Apply the nav-open class when toggle is true, and apply the nav class when toggle is false".

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Datatable link stops working after page one

From Dev

Datatable link stops working after page one

From Dev

Javascript - Code stops working after click on button

From Dev

Fixed button stops working after scrolling

From Dev

ng-click stops working after the first use of $compile when using nested directives

From Dev

ionic scroll stops working after some using

From Dev

ionic scroll stops working after some using

From Dev

ng-click stops working when using ng-if

From Dev

Resizable stops working on div after its contents are updated

From Dev

javascript stops working after link_to in rails 4

From Dev

Button Template - IsMouseOver stops working after IsPressed is executed

From Dev

Angular router link "stops" working?

From Dev

Android push using parse stops working after some time

From Dev

Android app stops working after moving to using creating the layout with java

From Dev

Ubuntu 18.04.3 stops working after using for long periods

From Dev

Camera stream using MediaCapture stops working after a while?

From Dev

Getting the ID of all button using its CLASS

From Dev

SDL button / event stops working

From Dev

Page stops processing after using createObject for a custom java class

From Dev

changing the content inside ng-include after click on a button/link

From Dev

changing the content inside ng-include after click on a button/link

From Dev

AVSpeechSynthesizer stops working after backgrounding

From Dev

SignalR Stops Working After A While

From Dev

textbox stops working after recreation

From Dev

pulseaudio stops working after hibernation

From Dev

JavaScript stops working after post

From Dev

ng-click stops working after first click, but only in later angular versions

From Dev

ng-click increase limit only works once and then stops working after adding one row to ng-repeat

From Dev

Submit button stops working in rails when using javascript to validate input fields when using form_tag

Related Related

  1. 1

    Datatable link stops working after page one

  2. 2

    Datatable link stops working after page one

  3. 3

    Javascript - Code stops working after click on button

  4. 4

    Fixed button stops working after scrolling

  5. 5

    ng-click stops working after the first use of $compile when using nested directives

  6. 6

    ionic scroll stops working after some using

  7. 7

    ionic scroll stops working after some using

  8. 8

    ng-click stops working when using ng-if

  9. 9

    Resizable stops working on div after its contents are updated

  10. 10

    javascript stops working after link_to in rails 4

  11. 11

    Button Template - IsMouseOver stops working after IsPressed is executed

  12. 12

    Angular router link "stops" working?

  13. 13

    Android push using parse stops working after some time

  14. 14

    Android app stops working after moving to using creating the layout with java

  15. 15

    Ubuntu 18.04.3 stops working after using for long periods

  16. 16

    Camera stream using MediaCapture stops working after a while?

  17. 17

    Getting the ID of all button using its CLASS

  18. 18

    SDL button / event stops working

  19. 19

    Page stops processing after using createObject for a custom java class

  20. 20

    changing the content inside ng-include after click on a button/link

  21. 21

    changing the content inside ng-include after click on a button/link

  22. 22

    AVSpeechSynthesizer stops working after backgrounding

  23. 23

    SignalR Stops Working After A While

  24. 24

    textbox stops working after recreation

  25. 25

    pulseaudio stops working after hibernation

  26. 26

    JavaScript stops working after post

  27. 27

    ng-click stops working after first click, but only in later angular versions

  28. 28

    ng-click increase limit only works once and then stops working after adding one row to ng-repeat

  29. 29

    Submit button stops working in rails when using javascript to validate input fields when using form_tag

HotTag

Archive