I came across this Firefox issue while working on a prototype site that had
certain state names.
Firefox browser ver: 44.0.2
Using Angular ver: 1.4.7
Summarized code:
-- Declaring stateProvider and my states.
File: app.js
angular.module('myApp',['ui-router']).config('$stateProvider','$urlRouterProvider','$locationProvider',[function(
$stateProvider,$urlRouterProvider,$locationProvider){
$stateProvider
.state('watch',{
url:'/home/'
// ... more code ...
};
//redirect handling
$urlRouterProvider.when('','/watch/');
$urlRouterProvider.when(/html/i,'#/watch/');
$urlRouterProvider.otherwise('/watch/');
}]);
In the ui-router.js @ line: 2308, in the function
*flushQueuedChildren(parentName)*, the variable "queued" is set.
- It's to be set as an array[].
function flushQueuedChildren(parentName) {
var queued = queue[parentName] || [];
// ... other code is here
}
All other browsers set the variable with the correct value. But Firefox
does a little things differently.
In this particular case, Firefox ignores the array[] type and it sets the
variable 'queued' as a function() type of "watch()"...
Here is an example below:
* - (state's name set as "watch", variable 'queued' should be an array, not
a function)*
<https://lh3.googleusercontent.com/-ileyqIx3tkQ/VsI2eA1uFPI/AAAAAAAAB7g/ZwgEqZtrEtg/s1600/firefox-ignores-type-of-array-ui-router.PNG>
*This also happens with the case of setting a state name to 'toString' or
any other function name.*
Just as a heads up, do not name your states that may be associated with a
name of a function[s].
This will result in an *$injecter:modulerr *and tell you that '.shift()' is
not a function of that var queued, since it is not defined as an "array[]".
This only happens in Firefox.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.