-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathangularjs_factory_new.html
More file actions
53 lines (43 loc) · 971 Bytes
/
angularjs_factory_new.html
File metadata and controls
53 lines (43 loc) · 971 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.2/angular.min.js"> </script>
<script>
var personman = function(info){
var user = info;
var factory = {};
factory.getfirst = function(){
return user.first;
},
factory.getlast = function(){
return user.last;
},
factory.getfull = function(seperator){
return user.first + seperator + user.last;
};
return factory;
}
angular.module('myApp', [])
.value('info', {
first: '' ,
last : '',
})
.factory('fact', personman)
.controller('cont', function($scope, info, fact){
info.first= 'sai';
info.last = 'teja';
$scope.insta= info;
$scope.inst = fact;
});
</script>
</head>
<body ng-app="myApp">
<div ng-controller="cont">
{{inst.getfirst()}}
{{inst.getlast()}}
{{inst.getfull('$$')}} </br>
<input type="text" ng-model="insta.first">
<input type="text" ng-model="insta.last">
</div>
</body>
</html>