# Ionic equivalent code of a javascript?

**URL:** <https://forum.ionicframework.com/t/ionic-equivalent-code-of-a-javascript/20089>\
**Category:** ionic-v1\
**Created:** [April 1, 2015, 7:27am UTC](https://forum.ionicframework.com/t/ionic-equivalent-code-of-a-javascript/20089 "2015-04-01T07:27:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![swapnesh](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@swapnesh](https://forum.ionicframework.com/u/swapnesh)\
**Post date:** [April 1, 2015, 7:27am UTC](https://forum.ionicframework.com/t/ionic-equivalent-code-of-a-javascript/20089/1 "2015-04-01T07:27:20Z")

</div>

What is the eqivalent ionic/angular code for the following JS code -

Angular Controller Code -

```
var testid = document.querySelector('#testid') || [];
if(testid.length == 0)
    testid.dataset = {};
var maxdateval = testid.dataset.maxdateval || -1000;
var mindateval = testid.dataset.mindateval || -90000;

```

Template Code -

```
<input type="date" name="field1" ng-model="answer" data-maxdateval="{{maxrange}}" data-mindateval="{{minrange}}" id="testid" >

```

Though its working in browsers, but I doubt it would work in mobile, let me know how I can achieve the desire output.
