搜尋

首頁  >  問答  >  主體

angular.js - ng-table title 沒了! ! ! !

如題。使用ng-table,在ng-repeat時用的data-title,標題卻沒顯示出來(其他都正常)。如下圖:

上代碼:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

<code>// controller。 state中 controllerAs: posts

.controller('PostManageIndexCtrl', [

                '$scope',

                '$timeout',

                'PostService',

                'NgTableParams',

                function ($scope, $timeout, PostService, NgTableParams) {

                    var self = this;

                    self.$injet = ["NgTableParams", "ngTableSimpleList"];

                    this.posts = {};

 

                    self.tableParams = createUsingFullOptions();

 

                    // init

                    function createUsingFullOptions() {

                        var initialParams = {

                            page: 1,

                            sorting: { created_at: "desc" },

                            count:5

                        };

                        var initialSettings = {

                            counts: [5, 20, 50, 100],

                            paginationMaxBlocks: 5,

                            paginationMinBlocks: 2,

                            getData: function(params) {

                           // console.log(PostService.fnGetPosts(params, $scope.filterValue));

                                return PostService.fnGetPosts(params, $scope.filterValue);

                            }

                        };

                        return new NgTableParams(initialParams, initialSettings);

                    }

 

                    //删除

                    self.fnDestroyPost = function (id) {

                        PostService.fnDestroyPost(id);

                    };

 

                    //筛选

                    $scope.$watch("filterValue", function () {

                        console.log('aaa');

                        self.tableParams.reload();

                    }, true);

 

                }])

                 

//接下来是html

 

<p class="row">

        <p class="col-xs-12">

            <p class="box">

                <p class="box-body">

                    <table  ng-table="posts.tableParams" class="table table-condensed table-bordered table-striped">

                        <tr ng-repeat="row in $data">

                            <td data-title="标题" sortable="'title'">[: row.title :]</td>

                            <td data-title="创建时间">[: row.created_at :]</td>

                            <td data-title="最后修改时间">[: row.updated_at :]</td>

                            <td data-title="操作">

                                <a style="margin:3px;" ui-sref="post.postManageEdit({postId:row.id})" class="X-Small btn-xs text-success ">

                                    <i class="fa fa-edit"></i> 编辑

                                </a>

                                <a style="margin:3px;" ng-click="posts.fnDestroyPost(row.id)" class="delBtn X-Small btn-xs text-danger ">

                                    <i class="fa fa-times-circle-o"></i> 删除</a>

                            </td>

                        </tr>

                    </table>

                </p>

            </p>

        </p>

    </p>

</code>

controller 中的console資料如下

控制台中報錯誤如下:

*n

我用 ng-table-dynamic self.cols 形式標題倒是沒問題,就是我要加那個操作那個td內容不知道該怎麼加進去。

求各位大神幫忙,感激不盡啊! ! !磕頭

巴扎黑巴扎黑2781 天前584

全部回覆(1)我來回復

  • 滿天的星座

    滿天的星座2017-05-15 17:12:04

    data-title-text="'寶寶可以在這裡插入文字了'"

    ps:一開始我也摸不著頭腦,ng-table我也沒用過。 。 。找了資料也對不上。 。直到我找到了ng-table的官網。 。 。

    回覆
    0
  • 取消回覆