I have just noticed that I have an exclamation mark after a hash (#!) in all of my routes. I'm not sure how and why I got them because earlier today I didn't have them.
If there is any solution to get rid of them, I would appreciate if someone can explain me what is it( and how I came to have them).
So, the only solution that I have found so far is to put manually put the exclamation mark on every href in my app, but this annoys me and I have no idea what to do.
I generated my app with yeoman generator and my app.js looks like this:
angular
.module('appNameApp', [
'ngAnimate',
'ngCookies',
'ngResource',
'ngRoute',
'ngSanitize',
'ngTouch'
])
.config(function ($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/main.html',
controller: 'MainCtrl',
controllerAs: 'main'
})
.when('/about', {
templateUrl: 'views/about.html',
controller: 'AboutCtrl',
controllerAs: 'about'
})
.when('/jaspo', {
templateUrl: 'views/about.html',
controller: 'jaspoCtrl',
controllerAs: 'vm'
})
.otherwise({
redirectTo: '/'
});
});
2. Not Secure Site Icons. Sites that are not fully secure and still use HTTP are shown up by the Grey circle with an exclamation point inside. This means that the site is not using a private connection as it does not have a security certificate.
The exclamation mark, !, or exclamation point (American English), is a punctuation mark usually used after an interjection or exclamation to indicate strong feelings or to show emphasis. The exclamation mark often marks the end of a sentence, for example: "Watch out!".
If you have ever noticed a double exclamation mark (!!) in someone's JavaScript code you may be curious what it's for and what it does. It's really simple: it's short way to cast a variable to be a boolean (true or false) value.
The exclamation mark is used to express exasperation, astonishment, or surprise, or to emphasise a comment or short, sharp phrase.
The hash and exclamation mark in a url are called a hashbang, and are usualy used in web applications where javascript is responsible for actually loading the page. Content after the hash is never sent to the server. So for example if you have the url example.com/#!recipes/bread.
We can use the exclamation mark (!) to execute specific commands from the history. 4.1. Execute the Previous Command $ echo 'Hello, World' Hello, World $ !! echo 'Hello, World' Hello, World 4.2. Execute the N th Command
EXCLAMATION MARK (HTML ! · !) ǃ The exclamation mark, !, also sometimes referred to as the exclamation point, especially in American English, is a punctuation mark usually used after an interjection or exclamation to indicate strong feelings, or to show emphasis.
Warning signs are often an exclamation mark enclosed within a triangle. Exclamation marks are used to emphasize a precautionary statement. On warning signs, an exclamation mark is often used to draw attention to a warning of danger, hazards, and the unexpected.
Modify these 2 lines :
.config(function ($routeProvider) {
$routeProvider
to be :
.config(function ($routeProvider,$locationProvider) {
$locationProvider.hashPrefix('');
$routeProvider
Credit should go to : https://stackoverflow.com/a/41223197/1564146
You probably updated angular version from 1.5 to 1.6, because on 1.6, the angular team decided to change the default $location hash-prefix to '!'. Like @Skrew suggested, you can change that to '' with $locationProvider.hashPrefix('');
Here you can read about that.
Your function is missing a locationProvider and needs to specify html5Mode for the locationProvider. See https://docs.angularjs.org/api/ng/provider/$locationProvider. Instead of:
.config(function ($routeProvider) {
$routeProvider
.when('/', {
try:
.config(function ($locationProvider, $routeProvider) {
$locationProvider.html5Mode({
enabled:true
});
$routeProvider
.when('/',{
By default you also need to specify a base tag <base href="/">
in your index.html file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With