javascriptangularjsfallbackprogressive-enhancement

How do I make a HTML fallback via Angular?


What is the best way to make a HTML fallback via Angular?

I need something like this:

<span>{{angularText}} plain text</span>

The plain text would be a "backup" (perhaps generated by the server), in case the user doesn't have JavaScript enabled. Of course, if the user has JavaScript enabled, then I obviously don't want both to show.


Solution

  • <span ng-bind="angularText">Default text from server</span>
    

    ?

    But like the others have mentioned, why use Angular to create an app if there's a slight chance some of the intended users have JS disabled?

    I suggest adding this to your site as well:

    <noscript>
    You do not have JS enabled.  Since this is an Angular based website, it won't do jack for you :-)
    </noscript>