小编Sur*_*osi的帖子

根据角度.js排序显示和隐藏箭头图标

我试图按照排序显示和隐藏箭头图标.我是角度js的新手,请帮助我使用bootstrap

<div ng-controller="PurchasesCtrl">
    <h2>Purchases:</h2>
    <table class="table">
    <thead>
        <tr >

            <th  ng-click="changeSorting('username')" >UserName <span  class="glyphicon glyphicon-chevron-up"></span><span  class="glyphicon glyphicon-chevron-down"></span></th>
            <th   ng-click="changeSorting('usertype')">UserType</th>
            <th  ng-click="changeSorting('age')" >Age</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="purchase in purchases.data|orderBy:sort.column:sort.descending">

            <td >{{purchase.username}}</td>
            <td>{{purchase.usertype}}</td>
            <td>{{purchase.age}}</td>
        </tr>
        </tbody>
    </table>
</div>
Run Code Online (Sandbox Code Playgroud)

角度js排序

var myApp = angular.module("myApp",[]);

myApp.factory("Purchases", function(){
    var Purchases = {};

    Purchases.data = [
        {
            username: "suraj kumar gosi",
            usertype: "sponer",
            age: "20"

        },
        {
            username: "kao kumar gosi",
            usertype: "clinet",
            age: "26"
        },
        {
             username: "surdfsdfaj kumar gosi",
            usertype: "clinfsdfset",
            age: "50" …
Run Code Online (Sandbox Code Playgroud)

angularjs

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

nvd3.js饼图以角度js导出到Excel

我正在使用nvd3.js来创建一个饼图.我想将此图表导出到Excel.出口我正在使用FileSaver.js

我的HTML看起来像:

<body ng-controller="MainCtrl">
<button ng-click="exportData()">click</button>
<div id="charts">
   <nvd3  options="options" data="data"></nvd3>
</div>    
</body>
Run Code Online (Sandbox Code Playgroud)

我的代码看起来像:

var app = angular.module('plunker', ['nvd3']);

app.controller('MainCtrl', function($scope) {

$scope.exportData = function () {
    alert("function call");
    var blob = new Blob([document.getElementById('charts').innerHTML ], {
        type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"
    });
    saveAs(blob, "Report.xls");
};

$scope.options = {
        chart: {
            type: 'pieChart',
            height: 500,
            x: function(d){return d.key;},
            y: function(d){return d.y;},
            showLabels: true,
            transitionDuration: 500,
            labelThreshold: 0.01,
            legend: {
                margin: {
                    top: 10,
                    right: 35,
                    bottom: 5,
                    left: 0
                }
            },   
        }
    };

    $scope.data …
Run Code Online (Sandbox Code Playgroud)

excel angularjs nvd3.js filesaver.js

5
推荐指数
0
解决办法
774
查看次数

标签 统计

angularjs ×2

excel ×1

filesaver.js ×1

nvd3.js ×1