Hi All,
Im a newbie to Angular. I have an issue re: changing location. I posted the
issue on Stack Overflow
<http://stackoverflow.com/questions/32965484/change-location-route-not-working>.
I would really appreciate any clues regarding the solution:
I am trying to change tab. The lines of code work when I do the following.
Obviously, Im not calling the Selected control method on ng-click from the
view. It worked as soon as I refresh the page.
app.controller('FormField', ['$scope', 'TabsService', function ($scope,
TabsService) {
var tabs = TabsService.getTabs();
TabsService.setRedirect(tabs[1]);
$scope.SelectedControl = function (control)
{
}}]);
However, when I insert the lines of code inside the SelectedControl
function, the code doesnt work. I can see the values. I can follow where
its going. $scope.$on is being executed and the values are correct. It even
switched the tab (css) however it doesnt load the controller contents.
Seems like something wrong is happening at changeRoute function but I cant
get my head around it.
app.controller('FormField', ['$scope', 'TabsService', function ($scope,
TabsService) {
$scope.SelectedControl = function (control)
{
var tabs = TabsService.getTabs();
TabsService.setRedirect(tabs[1]);
}}]);
$scope.changeRoute = function (url, forceReload) {
$scope = $scope || angular.element(document).scope();
if (forceReload || $scope.$$phase) { // that's right TWO dollar signs:
$$phase
window.location = url;
} else {
$location.path(url);
$scope.$apply();
}
};
--
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 http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.