首页 \ 问答 \ $ location.path(“/”);($location.path(“/”); not working properly)

$ location.path(“/”);($location.path(“/”); not working properly)

当我尝试使用$ location.path()时,url会发生变化但是我传入的内容.path会被添加到我当前的url中。 我希望当我执行我的addShow()时,我想去index.html这是我的主页。 能否请你帮忙。 网址改变如下: http:// localhost:8080 / add ,当我执行我的addShow函数时,它更改为: http:// localhost:8080 / add#/我希望它更改为转到我的主页。

angular.module('app').controller("MainController",['$location', function($location) {
      var vm = this;
      vm.title = 'TV Show';
      vm.searchInput = '';
      vm.shows = [{
        title: 'Game of Thrones',
        year: 2011,
        favorite: true
      }, {
        title: 'Walking Dead',
        year: 2010,
        favorite: false
      }, {
        title: 'Firefly',
        year: 2002,
        favorite: true
      }, {
        title: 'Banshee',
        year: 2013,
        favorite: true
      }, {
        title: 'Greys Anatomy',
        year: 2005,
        favorite: false
      }];
      vm.orders = [{
        id: 1,
        title: 'Year Ascending',
        key: 'year',
        reverse: false
      }, {
        id: 2,
        title: 'Year Descending',
        key: 'year',
        reverse: true
      }, {
        id: 3,
        title: 'Title Ascending',
        key: 'title',
        reverse: false
      }, {
        id: 4,
        title: 'Title Descending',
        key: 'title',
        reverse: true
      }];
      vm.order = vm.orders[0];
      vm.new = {};
      vm.addShow = function() {
        vm.shows.push(vm.new);
        console.log(vm.shows);
        vm.new = {};
        $location.path("/");
      };

    }]);

我的配置功能如下:

    (function() {

  "use strict";

  angular
    .module("app")
    .config(function($routeProvider, $locationProvider) {


      //$locationProvider.html5Mode(true);

      $routeProvider
        .when('/', {
          templateUrl: 'list.html',
          controller: 'MainController',
          controllerAs: 'main',
        })
        .when('/add', {
          templateUrl: 'add.html',
          controller: 'MainController',
          controllerAs: 'main',
        })
        ;

    });
})();

When I am trying to use $location.path(), the url changes but whatever I have passed in .path is appened to my current url. I want that when I execute my addShow(), I want to go to index.html which is my home page. Could you please help. The url changes like this: http://localhost:8080/add and when I execute my addShow function it changes to: http://localhost:8080/add#/ I want it to change to go to my home page.

angular.module('app').controller("MainController",['$location', function($location) {
      var vm = this;
      vm.title = 'TV Show';
      vm.searchInput = '';
      vm.shows = [{
        title: 'Game of Thrones',
        year: 2011,
        favorite: true
      }, {
        title: 'Walking Dead',
        year: 2010,
        favorite: false
      }, {
        title: 'Firefly',
        year: 2002,
        favorite: true
      }, {
        title: 'Banshee',
        year: 2013,
        favorite: true
      }, {
        title: 'Greys Anatomy',
        year: 2005,
        favorite: false
      }];
      vm.orders = [{
        id: 1,
        title: 'Year Ascending',
        key: 'year',
        reverse: false
      }, {
        id: 2,
        title: 'Year Descending',
        key: 'year',
        reverse: true
      }, {
        id: 3,
        title: 'Title Ascending',
        key: 'title',
        reverse: false
      }, {
        id: 4,
        title: 'Title Descending',
        key: 'title',
        reverse: true
      }];
      vm.order = vm.orders[0];
      vm.new = {};
      vm.addShow = function() {
        vm.shows.push(vm.new);
        console.log(vm.shows);
        vm.new = {};
        $location.path("/");
      };

    }]);

my config function is as below:

    (function() {

  "use strict";

  angular
    .module("app")
    .config(function($routeProvider, $locationProvider) {


      //$locationProvider.html5Mode(true);

      $routeProvider
        .when('/', {
          templateUrl: 'list.html',
          controller: 'MainController',
          controllerAs: 'main',
        })
        .when('/add', {
          templateUrl: 'add.html',
          controller: 'MainController',
          controllerAs: 'main',
        })
        ;

    });
})();

原文:https://stackoverflow.com/questions/34012071
更新时间:2024-04-22 20:04

最满意答案

要从第15行读取,请修改您的查询以使用表名作为FROM [Sheet1$A15:ZZ] -

var query = string.Format("select [Col1],[Col2],[Col3] from [{0}${1}]", "Sheet1","A15:ZZ");

A15表示标题行。

确保在连接字符串中设置了"HDR=YES"


To read from 15th row, modify your query to use table name as FROM [Sheet1$A15:ZZ]-

var query = string.Format("select [Col1],[Col2],[Col3] from [{0}${1}]", "Sheet1","A15:ZZ");

A15 represents header row.

Make sure that you have set "HDR=YES" in your connection string.

相关问答

更多

相关文章

更多

最新问答

更多
  • 带有简单redis应用程序的Node.js抛出“未处理的错误”(Node.js with simple redis application throwing 'unhandled error')
  • 高考完可以去做些什么?注意什么?
  • Allauth不会保存其他字段(Allauth will not save additional fields)
  • Flask中的自定义中止映射/异常(Custom abort mapping/exceptions in Flask)
  • sed没有按预期工作,从字符串中间删除特殊字符(sed not working as expected, removing special character from middle of string)
  • 怎么在《我的世界》游戏里面编程
  • .NET可移植可执行文件VS .NET程序集(.NET Portable Executable File VS .NET Assembly)
  • 搜索字符串从视图中键入两个字段的“名字”和“姓氏”组合(Search Strings Typed from View for Two Fields 'First Name' and 'Last Name' Combined)
  • 我可以通过配置切换.Net缓存提供程序(Can I switch out .Net cache provider through configuration)
  • 在鼠标悬停或调整浏览器大小之前,内容不会加载(Content Does Not Load Until Mouse Hover or Resizing Browser)
  • 未捕获的TypeError:auth.get不是函数(Uncaught TypeError: auth.get is not a function)
  • 如何使用变量值创建参数类(How to create a parameter class with variant value)
  • 在std :: deque上并行化std :: replace(Parallelizing std::replace on std::deque)
  • 单元测试返回Connection对象的方法(Unit Test for a method that returns a Connection object)
  • rails:上传图片时ios中的服务器内部错误(rails: server internal error in ios while uploading image)
  • 如何在Android中构建应用程序警报[关闭](How build an application Alarm in Android [closed])
  • 以编程方式连接到Windows Mobile上的蓝牙耳机(Programmatically connect to bluetooth headsets on Windows Mobile)
  • 在两个不同的SharedPreference中编写并获得相同的结果(Writing in two different SharedPreference and getting the same result)
  • CSS修复容器和溢出元素(CSS Fix container and overflow elements)
  • 在'x','y','z'迭代上追加数组(Append array on 'x', 'y', 'z' iteration)
  • 我在哪里可以看到使用c ++源代码的UML方案示例[关闭](Where I can see examples of UML schemes with c++ source [closed])
  • SQL多个连接在与where子句相同的表上(SQL Multiple Joins on same table with where clause)
  • 位字段并集的大小,其成员数多于其大小(Size of bit-field union which has more members than its size)
  • 我安装了熊猫,但它不起作用(I installed pandas but it is not working)
  • Composer - 更改它在env中使用的PHP版本(Composer - Changing the version of PHP it uses in the env)
  • 使用JavaFX和Event获取鼠标位置(Getting a mouse position with JavaFX and Event)
  • 函数调用可以重新排序(Can function calls be reordered)
  • 关于“一对多”关系的NoSQL数据建模(NoSQL Data Modeling about “one to many” relationships)
  • 如何解释SBT错误消息(How to interpret SBT error messages)
  • 调试模式下的Sqlite编译器错误“初始化程序不是常量”(Sqlite compiler errors in Debug mode “initializer is not a constant”)