国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

angular.js - angular ng-class里面的引號問題
巴扎黑
巴扎黑 2017-05-15 16:57:14
0
2
704

我有一個指令,template里面的ng-class="{glyphicon-chevron-down:isOpened, glyphicon-chevron-right: !isOpened}", 給glyphicon-chevron-down和glyphicon-chevron-right加單引號和雙引號都會報錯,不加引號也會報錯(ng-class里面的classname如果有 - 的話要加引號的)。這種情況該怎么辦呢?

.directive('brandItem', function (){
    return {
        restrict: 'EA',
        require: '^brandList',
        transclude: true,
        replace: true,
        scope: {
            title: '='
        },
        template: '<li ng-click="toggle()" class="list-group-item">'
                    +'<label><span class="glyphicon" ng-class="{glyphicon-chevron-down:isOpened, glyphicon-chevron-right: !isOpened}"></span>&nbsp;{{name}}</label>'
                    +'<p ng-transclude></p>'
                +'</li>',
        link: function (scope, element, attrs, brandListCtrl){
            scope.isOpened = false;
            brandListCtrl.addItem(scope);
            scope.toggle = function (){
                this.isOpened = !this.isOpened;
                brandListCtrl.getOpened(scope);
            }
        }
    }
});
巴扎黑
巴扎黑

全部回復(fù)(2)
某草草

ng-class="{'active':selected}"
1.4.5 下有效。以此類推。。單引號應(yīng)該有效

滿天的星座

第一,你的angular版本是多少?這個很關(guān)鍵!


詳細(xì)信息,參見 http://stackoverflow.com/questions/15557151/ngclass-style-with-dash-in-key

最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板