Ul-router url parameter with hashtag

I am working on routing my angular application, but I cannot find the following:

example.com/#parameter

In this URL channel #parameter should remain # parameter and receive parameter data. Now it removes # and goes toexample.com/parameter

If I go to example.com/#parameter, he has to do the same thing as if I go toexample.com/parameter

I have the following in my app.js application

 url: "/:bandName"

and send this data to my controller using $ stateParams

Is there a way to save the hashtag in the url?

- edit

so here is some code that works for input from /#parameter

        $urlRouterProvider.when(':#bandName', '/:bandName')
                .otherwise('/');
        $stateProvider.state('appband', {
                    url: "/:bandName",
                    templateUrl: "main.php",
                    controller: 'mainController'
        })

 $locationProvider.html5Mode(true);

With this, if I go to example.com/#randomBandName, I get redirected to example.com/randomBandName, and I get randomBandName as a parameter in my controller

, example.com/#randomBandName example.com/#randomBandName randomBandName .

$urlRouterProvider.when(':#bandName', '/:bandName'), .

+4

Source: https://habr.com/ru/post/1619971/


All Articles