2016-11-07 5 views
0

助けが必要です。私は、ページをナビゲートするためにangular.js UI-ROUTERを使用しています。ここで私はブラウザの新しいタブで1ページを開く必要があります。私は以下のコードを説明しています。ui-routerを使用して別のタブでページを開く方法Angular.js

New.html:ここ

<div class="input-group bmargindiv1 col-md-12"> 
    <span class="input-group-addon ndrftextwidth text-right oditek-form" style="width:180px">Latitude:</span> 
    <input type="text" name="latitude" id="latitude" class="form-control oditek-form" placeholder="Add Latitude coordinate" ng-model="latitude" ng-keypress="clearField('businessno');"> 
</div> 
<div class="input-group bmargindiv1 col-md-12" ng-if=" latitude"> 
    <a ui-sref="map" target="_blank">Display Location On The Map</a> 
</div> 

Latitudeフィールドに値がない場合を除き、上記のリンクDisplay Location On The Mapはまだここにユーザーに表示されなくなりますまで、フィールドに値がないが、そのはに表示しますユーザー。これは1つの問題です。私は以下のルーティングファイルについて説明しています。ここで

.state('new', { 
     url: '/new', 
     templateUrl: 'new.html', 
     controller: 'newController' 
    }) 
    .state('map', { 
     url: '/map', 
     templateUrl: 'map.html', 
     controller: 'mapController' 
    }) 

ユーザーが緯度の値はmap.htmlファイルに表示されているリンク(i.e-Display Location On The Map)をクリックしますとき、私は必要です。

map.html:

<div id="dvMap" style="width:1000px; height:1000px;">{{latitude}}</div> 

しかし、ここでは、ユーザーがそのリンクをクリックされたときにページが来ていません。それは次のメッセージを与えます。

Not Found 

The requested URL was not found on this server. 

は、ここに私のplunkr codeしなさいが私を助けています。 NG-場合のみで

+0

あなたが任意の値を入力していないとき、あなたのモデルが – Chetan

+0

@Chetanを空未定義とではありませんので、緯度(NG-場合=「緯度を!」)チェック:ユーザーが任意の値を入力されていない場合は!リンクは表示されません。だから 'ng-if ="!latitude "'はどのように動作するのでしょうか?私はそれが動作しない実装しました。 – satya

+0

ooh申し訳ありません....ちょうど逆の条件(ng-if = "latitude") – Chetan

答えて

0
 <!--Change you HTML with below.--> 

    <div class="input-group bmargindiv1 col-md-12"> 
     <span class="input-group-addon ndrftextwidth text-right oditek-form" style="width:180px">Latitude:</span> 
     <input type="text" name="latitude" id="latitude" class="form-control oditek-form" placeholder="Add Latitude coordinate" ng-model="latitude" ng-keypress="clearField('businessno');"> 
    </div> 
    <div class="input-group bmargindiv1 col-md-12" ng-if="latitude.length > 0"> 
     <a ui-sref="map" target="_blank">Display Location On The Map</a> 
    </div> 
関連する問題