Angular Js Hands On Solutions
Angular Js Hands On Solutions
app.controller('myCtrl', function($scope)
{
});
<--- index.js--->
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope)
{
$scope.first_name="first name";
$scope.last_name="last name";
});
<--- index.html--->
Hello <span type="text">{{first_name}}{{last_name}}</span> !
//Hello <Name>
<--- index.js--->
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope)
{
$scope.fullName="fullName";
});
<----index.html--->
Hello <span type="text">
{{fullName}}
</span> !
//ODD or EVEN
$scope.number1 = 0;
$scope.number2 = 0;
$scope.odd_even = function(result){
else{return "odd";}
}
//Sort and search
$scope.selectPriceFilter = function(priceFilter){
//Form Validation
$scope.registerUser = function(){
return "successful";
$scope.addToCart = function(products)
{
return "success";
};
$scope.quantity=0;
$scope.products = [
{
name : "Happy Cycle",
discount:"20%",
price: "2500",
brand : "Wheels",
addedToCart:false,
image : imgPath + "cycle.jpg",
quantity:0
},
{
name : "Kids Shoes",
discount:"10%",
price: "1460",
brand : "Feel Good",
addedToCart:false,
image : imgPath + "shoes.jpg",
quantity:0
},
{
name : "Polo Baby Care Dress",
discount:"20%",
price: "2500",
brand : "Super Hero",
addedToCart:false,
image : imgPath + "shirt.jpg",
quantity:0
},
];
$scope.addToCart = function(products){
alert("Product to add Cart successfully");
return "success";
};
$scope.users="";
$http.get("https://jsonplaceholder.typicode.com/users")
.then(function(response)
$scope.users = response.data;
});
$scope.products =
name:"Happy Cycle",
discount:"20%",
price:"2500",
brand : "Wheels",
addedToCart:false,
quantity:0
},
{
name : "Kids Shoes",
discount:"10%",
price: "1460",
addedToCart:false,
quantity:0
},
discount:"20%",price: "2500",
addedToCart:false,
quantity:0