zoukankan      html  css  js  c++  java
  • $http服务和$location

    1.angular的$http服务跟jquery中的ajax很类似,用法如下:

    $http({
      method : 'GET',
      url : 'data.php'
      }).success(function(data,state,headers,config){
        console.log(state);
      }).error(function(data){
        console.log(data);
    }); 

    其中method也可以为JSONP

    2.angular中的$location服务

    $location下有很多方法:

    bsUrl()

    path()

    replace()

    hash()

    search()

    url()

    host()

    port()

    protocol()

    有些只能用去获取,有些可以获取也可以设置

  • 相关阅读:
    导论
    Array
    Singleton
    Bridge
    Mediator
    interpreter
    Visitor
    Flyweight
    Command
    Chain Of Responsibility
  • 原文地址:https://www.cnblogs.com/toodeep/p/4984793.html
Copyright © 2011-2022 走看看