在路由中引用它之前的角度转换日期

时间:2015-05-24 02:13:30

标签: angularjs angular-routing

我的角度应用程序中有以下html:

$scope.expdate

我希望转换$scope.expdate.toUTCString()变量ui-sref,然后在from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.common.exceptions import * from selenium.webdriver.common.keys import Keys from random import uniform from xlutils.copy import copy import xlrd import wx import os import shutil import time from threading import * 中引用它。我该怎么办?

1 个答案:

答案 0 :(得分:2)

我认为你应该使用日期过滤器 https://docs.angularjs.org/api/ng/filter/date

或创建自己的:

app.filter('getUtcDate', [
    function() {
        return function(input) {
            return input.toUTCString();
        };
    }
]);

然后你可以这样做:

 <button type="submit" ui-sref="inventory({ expdate: expdate|getUtcDate })" class="btn btn-primary">Add</button>

编辑: 你能简单地使用:

<button type="submit" ui-sref="inventory({ expdate: expdate.toUTCString() })" class="btn btn-primary">Add</button>