Like any scope variable in AngularJS
$scope.fReg = {
id: 'something',
scode: 'something',
loc: 'something'
}
Manu
@EmmanuelDemey
2015-08-05 9:25 GMT+02:00 Vishnuraj OASYS <[email protected]>
:
> Can you please share a sample code to initialize?
>
> On Wednesday, August 5, 2015 at 11:04:46 AM UTC+4, Emmanuel DEMEY wrote:
>>
>> The solution is the second snippet.
>>
>> About the $scope.fReg undefined, do you intialize this variable before ?
>>
>> Regards
>>
>> Emmanuel
>> @EmmanuelDemey
>>
>> 2015-08-05 8:36 GMT+02:00 Vishnuraj OASYS <[email protected]>:
>>
>>> <pre><code>
>>> app.controller('InitCtrl',['$scope', function ($scope) {
>>>
>>> $scope.register = function () {
>>>
>>> var _data = { a: $scope.fReg.id + '[O0@]' + $scope.fReg.loc
>>> + '[O0@]' + $scope.fReg.scode ,b: deviceUniq ,c: deviceParm };
>>> _cL(_data);
>>> $http.post('someurl', _data).then(function () {
>>>
>>> },function () {
>>>
>>> });
>>>
>>> }
>>>
>>> }]);
>>>
>>>
>>> </code></pre>
>>>
>>>
>>> This code says $http is not defined.
>>> then i did this.
>>> <pre><code>
>>> app.controller('InitCtrl',['$scope','$http', function ($scope,$http) {
>>>
>>> $scope.register = function () {
>>>
>>> var _data = { a: $scope.fReg.id + '[O0@]' + $scope.fReg.loc
>>> + '[O0@]' + $scope.fReg.scode ,b: deviceUniq ,c: deviceParm };
>>> _cL(_data);
>>> $http.post('someurl', _data).then(function () {
>>>
>>> },function () {
>>>
>>> });
>>>
>>> }
>>>
>>> }]);
>>> </code></pre>
>>> This code has not error like the above one, but the value in $scope.fReg
>>> object is undefined. Those are my text fields in form.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "AngularJS" 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 http://groups.google.com/group/angular.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Emmanuel DEMEY
>> Consultant
>> Zenika
>> +33 (0)6 47 47 42 02
>> [email protected]
>>
>> - fr.linkedin.com/in/emmanueldemey/
>>
>>
>> Twitter : @EmmanuelDemey
>>
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" 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 http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>
--
Emmanuel DEMEY
Consultant
Zenika
+33 (0)6 47 47 42 02
[email protected]
- fr.linkedin.com/in/emmanueldemey/
Twitter : @EmmanuelDemey
--
You received this message because you are subscribed to the Google Groups
"AngularJS" 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 http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.