I am having below code in angular view page to apply date range.
<input type="text"
ui-options="{format: 'DD-MMM-YYYY'}"
min-date="02/10/86"
max-date="today"
ui-jp="datetimepicker"
class="form-control">
and it is not working.
Thanks for your time.
Related
i have the following HTML element and the calendar its supposed to open when you focus on it but it just doesn't happen, any suggestions?
<md-datepicker name="firstDate" ng-model="AddQuote.current.hotel.firstDate" ng-required="true" md-open-on-focus></md-datepicker>
When using angularjs to retrieve a value for a text input field with ng-value, the label the overlays the field doesn't transition above the field after the value is retrieved. I can only see the value in the input field after clicking on that field.
I'm using material's md-input-container:
<md-input-container>
<label>Name</label>
<input type="text" ng-value="profileInfo.name" ng-model="savedProfileInfo.name" class="provider-name" id="providerName" name="providerName" />
</md-input-container>
Here's the Inspect Element code:
<md-input-container class="">
<label for="providerName">Name</label>
<input type="text" ng-value="profileInfo.name" ng-model="savedProfileInfo.name" class="provider-name ng-pristine ng-untouched ng-valid md-input" id="providerName" name="providerName" aria-invalid="false" value="a"><div class="md-errors-spacer"></div>
</md-input-container>
You can clearly see that value="a" which was pulled after the page loaded using ng-value. But, the field still looks like this:
Only after I click on the field does it look how I would expect:
Is this a bug? Am I missing something? I though AngularJS and Material were supposed to play nice.
Available plunker here
In a roundabout way troig's comment helped me figure this out.
This form is used to display and update a user's profile information. I was using ng-model to update the user's profile and ng-value to display any existing user profile info from the database.
ng-value spits back the value="" attribute which does not play nice with md-input-container. To get this to work properly, I removed ng-value, replaced ng-model's value with profileInfo.name, and modified my controller to allow me to save profileInfo.name instead of savedProfileInfo.name.
Code translation:
<form ng-submit="saveProfile(profileInfo)">
<md-input-container>
<label>Name</label>
<input type="text" ng-model="profileInfo.name" class="provider-name" id="providerName" name="providerName" />
</md-input-container>
Moral of the story, ng-value does not play nice with md-input-container and form labels.
I am using Stripe with my angularJs app. Although the code below works fine, I wanted a month, year drop down for the expiry date.
<form stripe-form="stripeCallback" name="checkoutForm">
<input ng-model="number" placeholder="Card Number"
payments-format="card" payments-validate="card" name="card"/><br>
<input ng-model="expiry" placeholder="Expiration"
payments-format="expiry" payments-validate="expiry"
name="expiry"/><br>
<input ng-model="cvc" placeholder="CVC" payments-format="cvc" payments-validate="cvc" name="cvc"/><br>
<button class="checkout" type="submit" ng-disabled="checkoutForm.card.$invalid">Checkout</button>
</form>
How do I integrate two drop downs with this form?
Thanks.
Something along these lines would probably give you what you need.
<select ng-model='expiry_month' ng-change='expiry=expiry_month+"/"+expiry_year'>...</select>
<select ng-model='expiry_year' ng-change='expiry=expiry_month+"/"+expiry_year'>...</select>
I have a date input like this:
<input type="date" name="input" ng-model="date" placeholder="yyyy-MM-dd" class="form-control"/>
Now I want show calendar when click the input. How to controller the date calendar?
<input type="date"> is implemented on the level of the browser. I use Chrome and I do see datetime field.
I am having an issue with the angular ui datepicker. I have this value stored in the database: 2014-12-21T05:00:00.000Z and if I just have a plain text box bound to I get the output below. But when I add the data-picker directive it decrements a day off the value and displays 12-20-2014 instead of the correct 12-21-2014. What am I doing wrong? Thank you!
<input type="text" ng-model="incident.createdDate" /><p />
output is: 2014-12-21T05:00:00.000Z
<input type="text" ng-model="incident.createdDate" datepicker-popup="{{format}}" /><p />
output is: 12-20-2014