Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc for Angular Nativescript #8

Open
arcovoltaico opened this issue Jan 4, 2018 · 8 comments
Open

Doc for Angular Nativescript #8

arcovoltaico opened this issue Jan 4, 2018 · 8 comments

Comments

@arcovoltaico
Copy link

Hi Dave,
Could you add an installation & example doc for the Angular NS?
Thx!

@indianazhao
Copy link

+1

@indianazhao
Copy link

I just installed this plugin by the command tns plugin add nativescript-modal-datetimepicker and use it in my Angular NS.

main.component.ts:

import * as ModalPicker from 'nativescript-modal-datetimepicker';

pickDate() {
  const picker = new ModalPicker.ModalDatetimepicker();
  picker.pickDate({
    title: 'Please enter your birthday',
    theme: 'dark',
    maxDate: new Date(),
    is24HourView: false
  }).then((result) => {
    this.birthday = result['year'] + '-' + result['month'] + '-' + result['day'];
  }).catch((error) => {
    console.log('Error: ' + error);
  });
}

main.component.html:

<TextField hint="Please enter your birthday" [(ngModel)]="birthday" (tap)="pickDate()" editable="false"></TextField>

@EMGSoftware
Copy link

EMGSoftware commented Apr 13, 2018

There is one more step you need to take in order to work correctly:

  • Add import { ModalDatetimepicker } from "nativescript-modal-datetimepicker" to your app.module.ts and ModalDatetimepicker to the providers array as:
    providers: [ _BlablablaOtherProviders_, ModalDatetimepicker ],

@netivitton
Copy link

netivitton commented May 8, 2018

how to use webpack angular

@arcovoltaico
Copy link
Author

Thanks!

@shiv19 shiv19 reopened this Jun 16, 2018
@xandraureta
Copy link

how to use the clock instead of the time spinner for angular??

@samheihey
Copy link

samheihey commented Jun 21, 2019

how to use the clock instead of the time spinner for angular??

go to

App_Resources/Android/values-21/styles.xml

For Calendar, change the followings

<style name="SpinnerDatePicker" parent="android:Widget.Material.Light.DatePicker">
    <item name="android:datePickerMode">spinner</item>
</style>

to

<style name="SpinnerDatePicker" parent="android:Widget.Material.Light.DatePicker">
    <item name="android:datePickerMode">calendar</item>
</style>

For Clock, change the followings:

<style name="SpinnerTimePicker" parent="android:Widget.Material.Light.TimePicker">
    <item name="android:timePickerMode">spinner</item>
</style>

to

<style name="SpinnerTimePicker" parent="android:Widget.Material.Light.TimePicker">
    <item name="android:timePickerMode">clock</item>
</style>

@himanshukk81
Copy link

how to show only month in picker ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants