First I define an array:
$scope.workspaces = [{name: "Traffic Permits", state: "traffic-permits", classname: "tab_table ng-isolate-scope"}];
then I call it:
<a class="{{workspace.classname}}" ng-repeat="workspace in workspaces"
ui-sref="{{workspace.state}}" ui-sref-active="active">{{workspace.name}}
</a>
Seens pretty straightforward. I am just declaring a menu basically. However I am getting a strange error:
TypeError: a.hashPrefix is not a function
at Object.href (http://localhost:51188/Scripts/angular-ui-router.min.js:7:11776)
at Object.y.href (http://localhost:51188/Scripts/angular-ui-router.min.js:7:19457)
at link.t (http://localhost:51188/Scripts/angular-ui-router.min.js:7:24512)
at link (http://localhost:51188/Scripts/angular-ui-router.min.js:7:24721)
at nodeLinkFn (http://localhost:51188/Scripts/angular.js:6711:13)
at compositeLinkFn (http://localhost:51188/Scripts/angular.js:6105:13)
at publicLinkFn (http://localhost:51188/Scripts/angular.js:6001:30)
at $get.boundTranscludeFn (http://localhost:51188/Scripts/angular.js:6125:21)
at controllersBoundTransclude (http://localhost:51188/Scripts/angular.js:6732:18)
at ngRepeatAction (http://localhost:51188/Scripts/angular.js:20624:15) <a class="{{workspace.classname}} ng-binding ng-scope" ng-repeat="workspace in workspaces" ui-sref="{{workspace.state}}" ui-sref-active="active">
All help is appreciated thanks.
angular.module('myModule').config(function ($stateProvider, $urlRouterProvider) {
//
// For any unmatched url, redirect to /state1
$urlRouterProvider.otherwise("/traffic-permits");
//
// Now set up the states
$stateProvider
.state('traffic-permits', {
url: "/traffic-permits",
templateUrl: "/admin/permittable"
});
});
Ok, so I am now using the unminified version of the router. The error is being thrown at:
url = "#" + $locationProvider.hashPrefix() + url;
The error is $locationProvider.hashPrefix() is not a function
, what could this be???
I put a break point there. hashPrefix is an empty string.
Hash prefix is not a property - you use it to set the hash prefix.
https://docs.angularjs.org/guide/$location#-location-service-configuration
Figured it out:
apparently somebody thought it was a good idea to add this in the module config:
$locationProvider.hashPrefix = '';
ridiculous....