GET値

2016-09-07 12 views
0

これは私が前に使っていたコードだった...GET値

<div class="date_menu" ng-repeat="singledate in dates"> 
    <p> 
    {{singledate}} 

    <input type="radio" name="filterDateChosen2" ng-model="$parent.radioResult" ng-value="singledate"> 
    </p> 
</div></div> 

これは、ラジオボタンの形式で日付のリストを表示します。これがあれば、作品

myApp.directive('calendar', function() { 
    return function(scope, element, attrs) { 
     element.datepicker({ 
      inline: true, 
      dateFormat: 'dd-mm-yy', 
      onSelect: function(dateText) { 
       var modelPath = $(this).attr('ng-model'); 
       var val = $(this).attr('ng-value'); 
       putObject(modelPath, val, scope, dateText); 
       scope.$apply(); 
      } 
     }); 
    } 
}); 

...これは...私は、その後でそれにアクセスすることができました$parent.radioResult

<button ng-click="getVar(radioResult)"... 

を選択した日付を保存した。しかし、今、私の代わりにjQueryの日付ピッカーを使用したいです私は、日付を選択し、入力ボックスが表示されます...

<input calendar ng-model="$parent.radioResult" /> 

しかし、私が使用した場合の問題は、ある...

<button ng-click="getVar(radioResult)"... 

値が得られないのはなぜですか?これの理由は何ですか?

答えて

0

あなたは

$scope.$apply(function() { 
    $scope.dateValue = selectedDate; 
}); 
以下のようなスコープに変数に選択した日付を設定することにより、第1の角度のコンテキストにそれを持参する必要があるので、角度のコンテキストではないjQueryの日付ピッカーを使用しているので