单击以在新选项卡和同一选项卡上工作

时间:2017-05-23 06:11:06

标签: javascript jquery html angularjs

我需要ng点击以处理新标签以及自选标签。网址会根据条件动态显示。

HTML:

<a ng-href="{{myPathVariable }} "  ng-click=" GoToThemes()" class="shift-left">Themes</a>

控制器:

$scope.GoToThemes = function () {

    if ($sessionStorage.CategoryObj == null || $sessionStorage.CategoryObj == undefined || jQuery.isEmptyObject($sessionStorage.CategoryObj) || $scope.order.CategoryObj == undefined || $scope.order.CategoryObj == null || jQuery.isEmptyObject($scope.order.CategoryObj))
    {
        $scope.myPathVariable="/featured/themes";

    }
    else {
          $scope.myPathVariable = "/" + $sessionStorage.CategoryObj.Alias.replace(/[\. ,:-]+/g, "-").toLowerCase() + "/themes";

    }

1 个答案:

答案 0 :(得分:0)

如果我正确理解了您的问题,您可以使用表达式作为目标属性:

<a target="{{conditionToBlank?'_blank':'_self'}}" ng-href="{{myPathVariable }} "  ng-click=" GoToThemes()" class="shift-left">Themes</a>