Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Initial commit
  • Loading branch information
caeserbala authored Nov 15, 2016
1 parent a4d1fc1 commit f5c36c7
Show file tree
Hide file tree
Showing 13 changed files with 222 additions and 0 deletions.
Binary file added Thumbs.db
Binary file not shown.
22 changes: 22 additions & 0 deletions app.js
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);
}
});
20 changes: 20 additions & 0 deletions app1.js
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();
}]);





8 changes: 8 additions & 0 deletions css/style.css
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;
}
21 changes: 21 additions & 0 deletions factory/appfact.js
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;
});


19 changes: 19 additions & 0 deletions formcntrl.js
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);
};
}


] );





Binary file added images/Krishnakey.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Naga.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/inferno.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions index.html
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:"&#8360"}}</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>
39 changes: 39 additions & 0 deletions review.html
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>
21 changes: 21 additions & 0 deletions reviewfact.js
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;
}



);
43 changes: 43 additions & 0 deletions test.html
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>

0 comments on commit f5c36c7

Please sign in to comment.