This is common error when you attempt to open load files directly in chrome.
Chrome and other browsers have imposed security restrictions for “Cross Origin Requests“, which means that you cannot load the files directly from your local hard-disk to browser hence you required to load the files on some server using some protocol. Eg: http.
There are different ways to resolve this issue:
Approach-1:- Search for the path of your Chrome executable and then, on your cmd, try :
- Type “where chrome” into command prompt which will give you “C:PathToChrome.exe”
- Then type ” C:PathToChrome.exe –allow-file-access-from-files “
Note:-It is better to close all the browser instances before executing the above commands.
Approach-2:- If you have node setup then you can use http-server.
Execute npm install –g http-server and you will be able to access it using http-server C:pathtoapp
Step1:- install node.js
sudo npm install –g http-server
Step2:- Browse to the file location of .html file and execute the below command
Step3:- Access the file using http://127.0.0.1:8080/ in browser
Approach-3:- Mount Apache server and deploy your code to run the app.
Note:-Some IDE’s have default built in web servers like JetBrains, Eclipse
Do follow us for more learning and solutions Fb,G+,Twitter
Lets have corresponding code for above flow using directives:-
ng-switch on = expression
Used to show/hide the DOM element based on the expression.
- All it uses is Class =”ng-hide” and this class have CSS property of “display:none !important”.
- !important so that this property have the maximum weight and cannot be overridden.
- When expression is true then .ng-hide CSS is added causing element to be hidden and vice-verse.
- We can check the ng-hide class, using the inspect element.
At launch of code
Check the “Show Me” checkbox