Posts

Showing posts from July, 2017

AngularJS–Part 9, Values and constants

Image
Introduction This is a series of posts about  AngularJS  and our experiences with it while migrating the client of a complex enterprise application from Silverlight to HTML5/CSS/JavaScript using AngularJS as a framework. Since the migration is a very ambitious undertaken I want to try to chop the overall problem space in much smaller pieces that can be swallowed and digested much more easily by any member of my team. So far I have published the following posts in this series AngularJS – Part 1 AngularJS – Part 1, Feedback AngularJS – Part 2, the controller AngularJS – Part 3, Inheritance AngularJS – Part 4, Accessing server side resources AngularJS – Part 5, Pushing data to the server AngularJS – Part 6, Templates AngularJS – Part 7, Get ready to test AngularJS – Part 8, More choice when testing Sometimes we need some data that is globally available but at the same time we do not want to pollute the global (window) namespace with the definition for this data. ...

Angularjs Cookies

<!DOCTYPE html > < html lang= "en" ng-app= "myApp" > < head > < script src= "//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.1/angular.min.js" ></ script > < script src= "//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.1/angular-cookies.min.js" ></ script > < meta charset= "UTF-8" > < title > Title </ title > </ head > < body ng-controller= "MyController" > {{platformCookie}} {{myFruit}} </ body > < script > var myApp = angular.module( 'myApp' , [ 'ngCookies' ]); myApp .controller( 'MyController' , [ '$scope' , '$cookies' , '$cookieStore' , '$window' , function ($scope,$cookies,$cookieStore,$window) { $cookies. userName = 'Sandeep' ; $scope. platformCookie = $cookies. userName ; $cookieStore.put( 'fruit...

service passing

Simple service example: angular . module ( 'myApp' , []) . service ( 'sharedProperties' , function () { var property = 'First' ; return { getProperty : function () { return property ; }, setProperty : function ( value ) { property = value ; } }; }); Using the service in a controller: function Ctrl2 ( $scope , sharedProperties ) { $scope . prop2 = "Second" ; $scope . both = sharedProperties . getProperty () + $scope . prop2 ; } This is described very nicely in  this blog  (Lesson 2 and on in particular). I've found that if you want to bind to these p

url

http://techfunda.com/howto/462/one-way-data-binding http://www.c-sharpcorner.com/UploadFile/051e29/insert-value-from-radio-button-in-mysql-in-php/ http://techfunda.com/howto/528/radio-buttons http://www.tutorialsavvy.com/category/tutorials/javascript/angularjs/

Quiz

<!DOCTYPE html > < html lang= "en" > < head > < meta charset= "UTF-8" > < title > Title </ title > </ head > < body > < div ng-app= "myApp" ng-controller= "myCtrl" > < p > Today's welcome message is: </ p > < table class= "table table-condensed" > < thead > < tr > < th > Question </ th > < th > choice 1 </ th > < th > choice 2 </ th > < th > choice 3 </ th > < th > choice 4 </ th > < th > answer </ th > </ tr > </ thead > < tbody > < tr ng-repeat= "user in users" > < td > {{user.question}} </ td > < td > {{user.choice1}} </ td > ...