小编Har*_*ini的帖子

使用角度智能表的日期范围过滤器

我正在尝试在Angular Smart Table(http://lorenzofox3.github.io/smart-table-website/)上应用日期范围过滤器,但是,我无法做到这一点.我在网上看到的唯一一个例子是:http : //plnkr.co/edit/Idbc1JNHKylHuX6mNwZ6?p=preview也被打破了.

这是我的HTML:

<div st-table="releaseListDisplay" st-safe-src="releaseList">
        <div class="filter-box">
            <st-date-range></st-date-range>
        </div>
        <table class="list-page">
            <thead>
                <tr>
                    <th st-sort="releaseNum">Release#</th>
                    <th class="p15">Product Name</th>
                    <th st-sort="dateInternalRelease">Int. Release Date</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="release in releaseListDisplay">
                    <td>{{release.releaseNum}}</td>
                    <td>{{release.buildNum}}</td>
                    <td>{{release.dateInternalRelease | date:'yyyy-MM-dd'}</td>

                </tr>
            </tbody>
            <tfoot>
                <tr>
                    <td colspan="9">
                        <div st-pagination="" st-items-by-page="10"></div>
                    </td>
                </tr>
            </tfoot>
        </table>
    </div>
Run Code Online (Sandbox Code Playgroud)

这是st-date-range指令的template.html文件内容:

<label for="fromdate">From:</label>
<input type="date" name="fromdate" id="fromdate" 
       placeholder="MM/DD/YYYY" ng-model="fromDate"/>
<label for="todate">To:</label>
<input type="date" name="todate" id="todate" 
       placeholder="MM/DD/YYYY" ng-model="toDate"/>
Run Code Online (Sandbox Code Playgroud)

这是指令:

app.directive('stDateRange', function($timeout){
return{
    restrict:'E',
    require:'^stTable',
    templateUrl:'template.html', …
Run Code Online (Sandbox Code Playgroud)

javascript angularjs smart-table

5
推荐指数
1
解决办法
2984
查看次数

标签 统计

angularjs ×1

javascript ×1

smart-table ×1