$location

3084 단어 location
대체적으로 어떤 기능 조작이 있는지 이해한 후에 스스로 이것을 실현할 계획이다.
                    controller("ctrl", ["$scope", "$location", function ($scope, $location) {

                        //hash pattern   originUrl + "#/path?paraKey"

                        //$location  url , set paraKey   url

                        //start url : http://localhost:5715/Angularjs/location/Default.aspx

                        var location_obj = $location.url("/path?x=y y"); //  hash, #/path?x=y  url ,  $location                        

                        //now url : http://localhost:5715/Angularjs/location/Default.aspx#/path?x=y%20y

                        var afterHash_str = $location.url(); // hash# str : /path?x=y%20y ( )   

                        var currentUrl = $location.absUrl(); //location.href. ( )     

                        var http = $location.protocol(); //location.protocol

                        var host = $location.host(); //location.host

                        var port = $location.port(); //location.port

                        var path = $location.path(); // # /path, without paraKey

                        var hash = $location.hash(); //   

                        var paraKeys = $location.search(); // paraKey ,( )

                        $location.search({ x: "z z 1", y: "abc" }); //add and overwrite paraKey , cant clear

                        $location.search("y", null); //clear a paraKey

                    }]);

좋은 웹페이지 즐겨찾기