Why is this simple AngularJS ng-show not working?

后端 未结 7 683
旧时难觅i
旧时难觅i 2020-12-13 06:10

I cannot figure out why my simple AngularJS app not working as intended. \"Loading...\" is supposed to be hidden, and \"Done!\" should be shown after 1 second.

html:

7条回答
  •  佛祖请我去吃肉
    2020-12-13 06:32

    I have found that one way to work around ng-show not evaluating in the way you want it to be is to use ng-class instead.

     

    This way when $scope.loading is not equal to true the css class 'loaded' will be added to the element. Then you just need a to use the css class to show/hide the content.

    .mycontent {
        display: none;
    }
    
    .loaded {
        display: block;
    }
    

提交回复
热议问题