Hi,

I also uses the ng-init for the same problem. I know it is a poor approach 
but if there is any kind of standard approach will be there so please share 
with us. But I tried a lot to sync ng-value with ng-model but it would not 
work for me.

On Wednesday, September 26, 2012 at 1:48:31 PM UTC+5:30, 
[email protected] wrote:
>
> Hi,
>
> unfortunately, there are cases where the form should have default values 
> ​​as input [type = "hidden"]. Similar is like validation - for example: 
> ngMinlength / ngMaxlength / ngPattern, which are also on the element and 
> not defined in the $scope.
>
> Poor but functional process can be view as follows:
>
> <input type="hidden" ng-init="type ='type-1'" ng-model="type" 
> value="type-1" />
>
> http://docs.angularjs.org/api/ng.directive:ngInit
>
> JU
>
> On Wednesday, June 13, 2012 11:56:24 AM UTC+2, Marcello Nuccio wrote:
>>
>> Putting default values in the view, makes testing harder. The Angular way 
>> of setting defaults, is by setting them in the $scope.
>>
>> Il giorno martedì 12 giugno 2012 16:21:09 UTC+2, ganaraj p r ha scritto:
>>>
>>> Has anyone created a directive that sets the default value of an input 
>>> field?
>>>
>>> It seems like ngModel overwrites whatever is there in the value field.. 
>>> Ideally I would want it to overwrite if there is some value in ngModel.. 
>>> and not overwrite when the model is undefined or blank!
>>>
>>> -- 
>>> Regards,
>>> Ganaraj P R
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to