I am new to angularjs and totally confused,i am trying below code and dont know if it is right way.
index.html
<div class="input-group" ng-controller="validationController">
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span> </span>
<%= text_field_tag :checkindate, params[:checkindate], :placeholder => 'Select Date', :class=>'form-control datepicker input-lg',:required=>true,"ng-model" => "checkin.date"%>
</div>
<div class="input-group" ng-controller='validationController'>
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span> </span>
<%= text_field_tag :checkoutdate, params[:checkoutdate],:placeholder => 'Select Date', :class=>'form-control datepicker input-lg',:required=>true,"ng-model" => "checkout.date"%>
</div>
<p ng-show='isInvalidDate()'>Checkout Date Cannot be lesser than Checkin Date</p>
validationController.js
App.controller('validationController',['$scope', function($scope){
$scope.isInvalidDate = function(){
return $scope.checkout.date < $scope.checkin.date;
}
}]) ;
App.js
var App = angular.module('App',[]);
Now when I select check out date lesser than checkin date, error is not displayed. Can someone please point me in right direction?