angular.js - Ask about the communication between html and js in angularjs
黄舟
黄舟 2017-05-15 17:00:13
0
1
552

I have a question. I am using angular on a page on my PC. There is a question page called question/[qid]. How can I easily get this qid in angular’s ​​js?

The content of the question is loaded in php, only the answers, comments and other content are obtained from angular, and are loaded with the page at the beginning.
But when I get answers and comments through $http, I need to pass the qid parameter, so I have to find a way to get the value of qid.

I would like to know if there is a corresponding solution in angular.

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(1)
phpcn_u1582

Since your backend is PHP, it is the simplest way to directly load data and render HTML in the backend.

If you still want to get the URL, you can use

location.href

To get the current URL address
Get the last id through regular expression

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template