Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Upgrade to AngularJS
Message
 
 
To
All
General information
Forum:
AngularJS
Category:
Installation, Setup and Configuration
Title:
Upgrade to AngularJS
Miscellaneous
Thread ID:
01652834
Message ID:
01652834
Views:
49
UPDATE. Found this https://stackoverflow.com/questions/41226122/url-hash-bang-prefix-instead-of-simple-hash-in-angular-1-6

What do you think a better solution is - apply the config or adjust the code to deal with ! ?

---------------------------------------------------------------------------------------------------------------------------------------------------------------------

Hi everybody,

My colleague recently upgraded our AngularJS libraries to this version
/**
 * @license AngularJS v1.6.4
 * (c) 2010-2017 Google, Inc. http://angularjs.org
 * License: MIT
 */
This was a huge undertaking as there were some breaking changes.

One of the problem, however, seems to be in the routing.

We used to have routes that resolved to this
http://localhost:9753/SiriuswareControl/Specials/SpecialGroups#/edit/2
and now they are resolving to this
http://localhost:9753/SiriuswareControl/Specials/SpecialGroups#!/edit/2
Please note the extra ! before edit in the second variation.

As a result this code doesn't work anymore:
scope.editDeepLink = function () {
                  
                    var linkUrl = scope.dropdownSettings.routePath;

                    // check if dropdown is to be linked to items
                    if (angular.isDefined(scope.dropdownModel.value)
                        && angular.isDefined(scope.dropdownModel.value.departmeId)
                        && angular.isDefined(scope.dropdownModel.value.categoryId)
                        && angular.isDefined(scope.dropdownModel.value.itemId)) {
                        linkUrl += scope.dropdownModel.value.departmeId;
                        linkUrl += '/' + scope.dropdownModel.value.categoryId;
                        linkUrl += '/' + scope.dropdownModel.value.itemId;
                        //scope.dropdownModel.value = null;
                    }
                    else {
                        linkUrl += scope.dropdownModel.key;
                    };

                    //scope.toggleShowButtons();
                    if (scope.showEdit) {
                        window.open(linkUrl, '_blank');
                    };
                };
when we have our routePath defined as
 routePath: urlProtocolAndPath + "Items/BlackoutTemplates#/edit/"
Of course, one solution could be to adjust our directive to replace # with #! and hopefully it should work. Also fix couple of places where we used similar approach to open a new window.

The question is - do we need to apply this solution or there is some setting that can alter the behavior and make it use paths without extra ! ?

Thanks a lot in advance.
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform