Enhance your AngularJS application by incorporating Persian characters directly into the query string

There is a Persian character in the query string but the URL looks like this:

localhost:53297/#/Item/News/1-1-1-3?title=%D8%B1%D9%88%D9%86%D9%85%D8%A7%DB%8C%DB%8C%20%D8%A7%D8%B2%20%D8%AA%D8%A8%D9%84%D8%AA%20%D9%87%D8%A7%DB%8C%20%D8%B4%D8%B1%DA%A9%D8%AA%20HP

I would like the URL to be formatted as follows:

localhost:53297/#/Item/News/1-1-1-3?title=طلا-نقره

Answer №1

consider using the following method: decodeURIComponent(yourURL)

for a global approach, you can implement this code snippet:

$rootScope.$on('$locationChangeStart', function (event, updatedUrl, previousUrl) {
    $location.$$absUrl = decodeURIComponent(updatedUrl);
});

Answer №3

element, I made some adjustments to answers:
var updatedUrl = persianJs(searchQuery).adjustURL().toString();

$rootScope.$on('$locationChangeStart', function (e, updatedUrl, oldUrl) {
    $location.$$absUrl = decodeURIComponent(updatedUrl);
});

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Issue: Attempting to send a POST request to the specified API endpoint for creating a product category resulted in a 500 Internal Server Error

My current task involves inserting data into a table using the POST method with an Angular service function. angular.module("productCategoryModule") .factory("productCategoryService",productCategoryService); productCategoryService.$inject = ['$http& ...

Issue with Angular HTTP API get request not reaching intended Express server function

I am facing an issue with my Angular application where I need to retrieve data from a MongoDB collection. The problem arises when I make two HTTP API calls ("query" and "get") from flConstruct to fetch data from the server. The "query" call works perfectly ...

Navigable MEAN.js paths for CRUD operations

Exploring the world of MEAN stack with mean.js as my structure framework. Playing around with Express and Angular routing to understand how it all works. Here's one of my server routes: app.route('/api/projects/:projectId') .get(users. ...

Express app: the ideal location to implement a closed-loop temperature control system

I am relatively new to working with express.js, having only created some basic client/server apps in the past. Currently, I am looking to develop a temperature controller using a PID component. However, I am struggling to grasp the architecture of express ...

Error in MEAN CRUD operation cannot be determined

{ text: undefined, done: false, _id: 529e16025f5222dc36000002, __v: 0 } PUT /api/todos/529e16025f5222dc36000002 200 142ms - 68b Encountering an issue while updating my CRUD todo list. Despite receiving a successful status code of 200 after submittin ...

AngularJS - Import and save CSV files

I have set up a nodeJS program as the server and an AngularJS web application as the client. For generating CSV files, I am utilizing the "express-csv" library (https://www.npmjs.com/package/express-csv) Below is the code for the server side: Definition ...

Dealing with a Nodejs/Express and Angular project - Handling the 404 error

Recently, I decided to dive into learning the MEAN stack and thought it would be a great idea to test my skills by building an application. My goal was simple: display a static variable ('hello') using Angular in the HTML. However, I ran into an ...

Attempting to show the name in AngularJS

I've been working on mastering Angular JS, but I'm facing a challenge with displaying the user I just added to the database on the next page. While I can display other users, the newly added user's data just won't show up! I've tri ...

Verify the identity of all REST API requests without the need for a username or password in order to obtain a

I have a unique setup where I am selling products. The API fetches product data from a centralized node back-end and displays it on an angular front-end that is hosted on multiple domains. The challenge I'm facing is the need to authenticate all reque ...

Troubleshooting issues with AngularJS routing

Having trouble clicking on the show button and seeing anything displayed. I've spent a lot of time on this without success, can someone please assist. Files.... app.js controller.js index.html show.html index.html <html ng-app='Java4sApp& ...

The connection between AngularJS and the Node.js server is struggling with sending input data, resulting in a 404 error message

Why is the HTTP address not found? I am seeing these mistakes in the console: POST http://localhost:3000/api/message 404 (Not Found) angular.min.js XHR finished loading: POST "http://localhost:3000/api/message". angular.min.js Error " ...

The issue of the Angular controller not functioning properly in conjunction with Node Express

After creating an angular app (version 1.5.7), I wanted to deploy it to heroku. To do this, I implemented Node and used express to serve the main index.html file for heroku to build since it doesn't support plain angular apps. However, after making th ...

What's the deal with Mongoose and preloading data?

There is an issue I am facing with regards to retrieving a document from mongodb. In my node.js server configuration, I have the following call: app.get('/ruimtes/:afkortingCampus', function (req, res) { Ruimtes.find({'campusAfkorting&apo ...

Data loss from AngularJS multipartForm directive when redirecting to different routes

Having trouble with an Excel file uploader and data parsing in the routes? It seems like the FormData is getting lost when sent through the $http service route. Any advice or experience on how to handle this issue would be greatly appreciated! Html View: ...

What are the steps for hosting an AngularJS application or M.E.A.N. client-side app on an Apache or NodeJS server?

After completing a MEAN stack app with basic CRUD functionality, I successfully hosted the server side API built in nodejs. However, I am currently facing challenges when it comes to hosting the client side UI. The UI is constructed using angularjs and ...

Designing personalized visualizations using elasticsearch

After setting up ELK tools, I have a desire to extract data from Elasticsearch and generate my own graphs without relying on Kibana. I've heard about tools like elasticsearch.js, but I'm unsure how to begin using it. What steps should I take in o ...

Exploring the FormData Object in Mongoose

Currently, I am in the process of developing a geolocationAPI that would allow users to query locations based on their specified minimum and maximum distance. However, I am facing difficulties in retrieving these values within my controller. Here is a sni ...

When using Lockdown.js with NPM, I encounter a blank file being returned

When using Lockdown.js for NPM, I encountered an issue where the command to generate the lockdown file resulted in an empty file. Here are the links for the dependencies: NPM lockdown git Here is a snippet from my package.json: { "name": "nw", "pri ...

The nodejs events function is being triggered repeatedly

I have been developing a CMS on nodejs which can be found at this link. I have incorporated some event hooks, such as: mpObj.emit('MP:FOOTER', '<center>MPTEST Plugin loaded successfully.</center>'); Whenever I handle this ...

How does the interaction between Express and Angular for routing in the MEAN Stack function?

Currently, I am utilizing Express static to direct to the public directory. //app.js app.use(express.static( __dirname + '/public')); I am looking for a way to have most of the UI routing done by AngularJS. However, it seems that it only works ...