How to get value of textboxes after button press in AngularJS

Published on

HTML: <label class=”item item-input item-stacked-label”> <span class=”input-label”>Company :</span> <input type=”text” placeholder=”Company” ng-model=”company”> </label> <button class=”button button-positive” style=”margin-top:10px;” ng-click=”saveChanges()”> Save Changes </button> In corresponding CONTROLLER: $scope.saveChanges = function() { alert($scope.company); };

How can push value to nested ng-repeat in angularjs

Published on

<div ng-repeat=”vehicle in vehicleList”> <div>{{vehicle.number}}</div> <input name=”addName” value=”add” ng-click=”addVehicle($index, vehicle)”> <div ng-repeat=”categoryList in vehicle.category”> <div>{{categoryList.name}}</div> </div> </div> $scope.vehicleList = []; $scope.addVehicle = function(index, vehicle) { $scope.vehicleList[index].category.push({ name: vehicle }); };

How does data binding work in AngularJS?

Published on

Here is an example of data binding with AngularJS, using an input field. I will explain later HTML Code <div ng-app=”myApp” ng-controller=”myCtrl” class=”formInput”> <input type=”text” ng-model=”watchInput” Placeholder=”type something”/> <p>{{watchInput}}</p> </div> AngularJS Code myApp = angular.module (“myApp”, []); myApp.controller(“myCtrl”, [“$scope”, function($scope){ //Your Controller code goes here }]); As you can see in the example above, AngularJS … Continue reading How does data binding work in AngularJS?

How to pass parameter with $location directive in Anjularjs

Published on

Please try this. $location.path(‘/myURL/’).search({param: ‘value’}); will result in `/myURL/?param=value` OR $location.path(‘/myURL/’+ param1); Please find $location for more details EDIT CODE 2: here what I have tried. HTML : <div ng-controller=”testCtrl”> <a ng-click=”setParam()” href=”javascript:void(0)”>send query param</a> <br> <a ng-click=”getParam()” href=”javascript:void(0)”>get query param</a> </div> JS : app.controller(“testCtrl”,function($scope,$location){ var obj = { id: “331e25d6-fbb5-42a5-b76d-fcac9b30a26e”, trash: false, identity: “momo”, … Continue reading How to pass parameter with $location directive in Anjularjs

How to fit the image properly in div

Published on

Way to fit the image properly in div. Use the below Javascript for re-size the image: window.imagefit = function (img){ var width = img.naturalWidth; var logoHeight = img.naturalHeight; var ans = calculateAspectRatioFit(width, logoHeight, img.clientWidth, img.clientHeight); img.style.height = ans.height+’px’; img.style.width = ans.width+’px’; } function calculateAspectRatioFit(srcWidth, srcHeight, maxWidth, maxHeight) { var ratio = Math.min(maxWidth / srcWidth, maxHeight … Continue reading How to fit the image properly in div

HTML / CSS Popup div on click

Published on

HTML / CSS Popup div on click. How¬†to make popup div instead of popup window for web page? <!DOCTYPE html> <html > <head> <style type=”text/css”> .button { width: 150px; padding: 10px; background-color: #FF8C00; box-shadow: -8px 8px 10px 3px rgba(0,0,0,0.2); font-weight:bold; text-decoration:none; } #cover{ position:fixed; top:0; left:0; background:rgba(0,0,0,0.6); z-index:5; width:100%; height:100%; display:none; } #loginScreen { height:380px; … Continue reading HTML / CSS Popup div on click

Node JS Tutorials for Beginners

Published on

Tutorials NodeSchool.io interactive lessons The Art of Node (an introduction to Node) Hello World Example Hello World Hello World Web Server Node.js guide Build a blog with Node.js, express and MongoDB Node.Js Tutorials At Project 70 Node.js for Beginners Learn Node.js Completely and with Confidence Absolute Beginners Guide To Node.js Developer Sites Joyent’s developer site … Continue reading Node JS Tutorials for Beginners