-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
13 changed files
with
222 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
var mainApp = angular.module("mainApp", []); | ||
|
||
mainApp.factory('MathService', function() { | ||
var factory = {}; | ||
|
||
factory.multiply = function(a, b) { | ||
return a * b | ||
} | ||
return factory; | ||
}); | ||
|
||
mainApp.service('CalcService', function(MathService){ | ||
this.square = function(a) { | ||
return MathService.multiply(a,a); | ||
} | ||
}); | ||
|
||
mainApp.controller('CalcController', function($scope, CalcService) { | ||
$scope.square = function() { | ||
$scope.result = CalcService.square($scope.number); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
var myApp=angular.module("myApp",[]); | ||
|
||
|
||
myApp.controller('myctrl', ['$scope' , 'myService' ,function($scope, myService) | ||
|
||
{ | ||
$scope.bookcnt = function () | ||
{ | ||
|
||
$scope.result = myService.intialValue(); | ||
|
||
|
||
} | ||
$scope.bookcnt(); | ||
}]); | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.nagaImg | ||
{ | ||
background-image: url('/images/Naga.jpg'); | ||
} | ||
|
||
h1{ | ||
margin-bottom: 0px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
var myApp=angular.module("myApp"); | ||
myApp.factory( 'myService', function (){ | ||
var factory ={}; | ||
|
||
factory.intialValue = function() | ||
{ | ||
var books =[]; | ||
var book={title:"DanBrown ", price:"250" , author:"Dan Brown", soldout:false,img_url : "images/inferno.jpg",notAvailable:false }; | ||
books.push(book); | ||
book={title:"Screats of Naga ", price:"300" , author:"amith mishra", soldout:true, img_url :"images/Naga.jpg",notAvailable:false }; | ||
books.push(book); | ||
book={title:"Krishana Key ", price:"300" , author:"Ashwin", soldout:false, img_url :"images/Krishnakey.jpg", notAvailable:false}; | ||
books.push(book); | ||
return books; | ||
// var books="krishna"; | ||
|
||
} | ||
return factory; | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
var myApp=angular.module("myApp"); | ||
|
||
|
||
myApp.controller('formcntrl', ['$scope','reviewfact' , function($scope,reviewfact) | ||
{ | ||
$scope.submit = function() | ||
{ | ||
var review ={rrate : $scope.rate, rreview : $scope.review, remail : $scope.email}; | ||
$scope.reviewdis = reviewfact.addreview(review); | ||
}; | ||
} | ||
|
||
|
||
] ); | ||
|
||
|
||
|
||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<html> | ||
<head> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="css/style.css"> | ||
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js"></script> | ||
|
||
<script type="text/javascript" src="app1.js" ></script> | ||
<script type="text/javascript" src="factory/appfact.js" ></script> | ||
|
||
|
||
</head> | ||
<body> | ||
<div ng-app="myApp" ng-controller="myctrl"> | ||
|
||
|
||
<div ng-repeat =" x in result"> | ||
<div ng-hide ={{x.notAvailable}} > | ||
<h1> {{x.title}} | ||
<p style="float:right; font-size: 20px;" >{{x.price | currency:"₨"}}</p> | ||
</h1> | ||
<p > {{x.author}}</p> | ||
<img ng-src='{{x.img_url}}' style="width:200px ; height:200px" /> <button name="addtocart" ng-hide={{x.soldout}}>addtocart</button> | ||
|
||
<span> </span> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<html> | ||
<head> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="css/style.css"> | ||
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js"></script> | ||
|
||
<script type="text/javascript" src="app1.js" ></script> | ||
<script type="text/javascript" src="formcntrl.js" ></script> | ||
<script type="text/javascript" src="reviewfact.js" ></script> | ||
<script type="text/javascript" src="factory/appfact.js" ></script> | ||
|
||
|
||
</head> | ||
|
||
<body> | ||
<div ng-app="myApp" ng-controller="formcntrl"> | ||
|
||
<h2>Review</h2> | ||
|
||
<div ng-repeat ="x in reviewdis" > | ||
{{x.email}} | ||
|
||
</div> | ||
<form > | ||
Rate book <select ng-model="rate"> | ||
<option value="1">1</option> | ||
<option value="2">2</option> | ||
<option value="3">3</option> | ||
<option value="4">4</option> | ||
<option value="5">5</option> | ||
</select> <br /> | ||
<textarea value="text" ng-model="review"></textarea> <br \> | ||
<input type="email" name="email" ng-model="email"/> <br \> | ||
<button type="submit" ng-click="submit()">Submit Review</button> | ||
</form> | ||
|
||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
var myApp = angular.module("myApp"); | ||
myApp.factory('reviewfact', | ||
function(){ | ||
var factory ={}; | ||
|
||
factory.addreview= function(review) | ||
{ var temp= review; | ||
|
||
var reviews =[]; | ||
reviews.push(temp); | ||
|
||
return reviews; | ||
} | ||
|
||
|
||
return factory; | ||
} | ||
|
||
|
||
|
||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<html> | ||
|
||
<head> | ||
<title>Angular JS Services</title> | ||
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> | ||
</head> | ||
|
||
<body> | ||
<h2>AngularJS Sample Application</h2> | ||
|
||
<div ng-app = "mainApp" ng-controller = "CalcController"> | ||
<p>Enter a number: <input type = "number" ng-model = "number" /></p> | ||
<button ng-click = "square()">X<sup>2</sup></button> | ||
<p>Result: {{result}}</p> | ||
</div> | ||
|
||
<script> | ||
var mainApp = angular.module("mainApp", []); | ||
|
||
mainApp.factory('MathService', function() { | ||
var factory = {}; | ||
|
||
factory.multiply = function(a, b) { | ||
return a * b | ||
} | ||
return factory; | ||
}); | ||
|
||
mainApp.service('CalcService', function(MathService){ | ||
this.square = function(a) { | ||
return MathService.multiply(a,a); | ||
} | ||
}); | ||
|
||
mainApp.controller('CalcController', function($scope, CalcService) { | ||
$scope.square = function() { | ||
$scope.result = CalcService.square($scope.number); | ||
} | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |