You are missing double quotes around the ng-model
in your template:
ng-model=thisNgmodel
Should be ng-model="thisNgmodel"
Example of ng-init
:
<div use-date-picker ng-init="something = 1" this-ngmodel="something"></div>
Example of passing string to directive:
To pass a string variable to your directive use the @
sign.
<div use-date-picker string-var="test"></div>
scope: {
stringVar: '@'
},
template: '<input type="text" value="{{stringVar}}" />'
Now you will be able to pass a string value to your directive and the value
attribute on your input will default in with that text. It makes more sense to bind a property to your text box through ng-model
though so you can retrieve its value later. By initializing your ng-model
value as seen in the previous example you will achieve the same effect.