Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在新选项卡中打开链接,但在angularjs中没有基本url_Angularjs - Fatal编程技术网

在新选项卡中打开链接,但在angularjs中没有基本url

在新选项卡中打开链接,但在angularjs中没有基本url,angularjs,Angularjs,我想在“新建”选项卡上打开url。我正在做以下工作: $scope.portal.jdURL = 'www.google.com'; $scope.openURL = function() { if($scope.portal.jdURL != '') { window.open($scope.portal.jdURL, '_blank'); } }; 我希望结果如下: www.google.com 但它的开放url如下所示: $sco

我想在“新建”选项卡上打开url。我正在做以下工作:

$scope.portal.jdURL = 'www.google.com';

$scope.openURL = function()
 {

     if($scope.portal.jdURL != '')
     {
         window.open($scope.portal.jdURL, '_blank');
     }

 };
我希望结果如下:

www.google.com

但它的开放url如下所示:

$scope.portal.jdURL = 'www.google.com';

$scope.openURL = function()
 {

     if($scope.portal.jdURL != '')
     {
         window.open($scope.portal.jdURL, '_blank');
     }

 };

只需改变即可

$scope.portal.jdURL = 'www.google.com';


试试这个
$window.open('//google.com')看看这个ans。它可以工作。但用户可以输入任何格式的url。比如www.google.com或者仅仅是google.com或者。它应该适用于任何输入。