Angular js清除标签标题

时间:2013-12-07 11:33:40

标签: angularjs

我正在使用带有标签内容的角度指令。

如何清除标题页?内容已清除但不是标题。

  gfApp.directive('myTabs', function() {
    return {

        restrict: 'E',
        transclude: true,
        scope: {},
        link: function(scope, element, attrs, tabsCtrl) {
            console.log(scope);
            console.log("LOL");
        },
        controller: function($scope) {
            var panes = $scope.panes = [];

            var scope = $scope;

            $scope.select = function(pane) {
                angular.forEach(panes, function(pane) {
                    pane.selected = false;
                });

                if (pane.recommended === true) {
                    console.log(1);
                    pane.selected = true;
                } else {
                    console.log(2);
                    pane.selected = true;
                }
            //console.log($scope.$parent.recommended_shirts);
            };

            this.addPane = function(pane) {
                panes.push(pane);
                console.log(panes.length);
                if (panes.length  == $scope.$parent.recommended_shirts.length) {

                    angular.forEach(panes, function(pane) {
                        if (pane.recommended == 'true') {
                            $scope.select(pane);
                        }
                    });              
                }
            };
        },
        templateUrl: 'partial/my-tabs.html'
    };
})
.directive('myPane', function() {
    return {
        require: '^myTabs',
        restrict: 'E',
        transclude: true,
        scope: {
            title: '@',
            recommended: '@',
        },
        link: function(scope, element, attrs, tabsCtrl) {
            tabsCtrl.addPane(scope);
        },
        templateUrl: 'partial/my-pane.html'
        };
});

以下视图

<my-tabs>
    <my-pane title="{{shirt.shirt_size}}{{shirt.star}}" ng-repeat="shirt in recommended_shirts" recommended="{{shirt.recommended}}">
        <div>
            <table ng-class="{selected:shirt.recommended}" style="margin: 5px auto; width: 96%" class="table table-bordered table-hover">
                <thead>
                    <tr>
                        <th width="168px">Area</th>
                        <th>Score</th>                                
                    </tr>                                
                </thead>
                <tbody>
                    <!--data-title="How to improve a Poor fit score:" data-content="Your Fit Score reflects the accuracy of your measurements based on the inputs you've given us. To improve your score, review your inputs for this particular part of your shirt and ensure that they are correct. Adding more shirts also improves the accuracy of your fit profile." -->
                    <tr>
                        <td>Collar</td>
                        <td>
                            <span>{{shirt.area.collar.result.result}}<span>
                        </td>
                    </tr>
                    <tr>
                        <td>Sleeve</td>
                        <td>
                            <span>{{shirt.area.half_shoulder_sleeve.result.result}}<span>
                        </td>
                    </tr>
                    <tr>
                        <td>Chest</td>
                        <td>
                            <span>{{shirt.area.collar.result.result}}<span>
                        </td>
                    </tr>

                    <tr ng-hide="shirt.show_more">
                        <td colspan="2" ng-click="shirt.show_more = !shirt.show_more">
                            Show more
                        </td>
                    </tr>
                    <tr ng-show="shirt.show_more">
                        <td>Waist</td>
                        <td>
                             <span>{{shirt.area.waist.result.result}}<span>
                        </td>
                    </tr>                            
                    <tr ng-show="shirt.show_more">
                        <td>Hips</td>
                        <td class="">
                             <span>{{shirt.area.hips.result.result}}<span>
                        </td>
                    </tr>                            
                    <tr ng-show="shirt.show_more">
                        <td>Length</td>
                        <td>
                             <span>{{shirt.area.length.result.result}}<span>
                        </td>
                    </tr>
                    <tr ng-show="shirt.show_more">
                        <td>Shoulder</td>
                        <td>
                            <span>{{shirt.area.shoulder.result.result}}<span>
                        </td>
                    </tr>
                    <tr ng-show="shirt.show_more">
                        <td>Biceps</td>
                        <td>
                            <span>{{shirt.area.biceps.result.result}}<span>
                        </td>
                    </tr>
                    <tr ng-show="shirt.show_more">
                        <td>Wrist</td>
                        <td>
                             <span>{{shirt.area.wrist.result.result}}<span>
                        </td>
                    </tr>                                                    
                    <tr ng-show="shirt.show_more">
                        <td colspan="2" ng-click="shirt.show_more = !shirt.show_more">
                            Show less
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </my-pane>
     </my-tabs>

0 个答案:

没有答案