Angularjs routing in different files

前端 未结 2 1572
长发绾君心
长发绾君心 2021-01-30 11:02

I\'m checking out angular routing.

http://www.bennadel.com/blog/2420-Mapping-AngularJS-Routes-Onto-URL-Parameters-And-Client-Side-Events.htm

The examples I see h

2条回答
  •  野性不改
    2021-01-30 11:48

    You can make the Angular application with different files without specifing them follow this steps

    Step 1: Get the full url

    var url = window.location.pathname;
    

    Step 2 Sorting the filename alone

    var filename = url.substring(url.lastIndexOf('/')+1);

    Step 3 Displaying the result

    alert(filename);
    

    I have done this in w3schools try it editor http://www.w3schools.com/code/tryit.asp?filename=FDP3QTCP7V4E

提交回复
热议问题