Category Archives: Javascript

What are Objects in Javascript ? – Code Samples

Wrote this article on Objects & Javascript for future reference. Codecademy.org is my favorite go-to-place for learning Javascript. Javascript Objects could be defined in following three manners. Objects created as Variables Objects created using new Object() Objects created using Constructor   Objects created as Variables // Defining object as a variable var School = { name: “DAV Public School”, studentsCount: 600, admissionOpen: false, }; School.isAdmissionOpen = function() { return this.admissionOpen; }; School.setAdmissionStatus = function( openOrClosed ) { this.admissionOpen = openOrClosed; };   Objects created using new Object() In the example below, College is an object type. // Creating object using new Object() var College = new Object(); College.name = “IIT …

Continue reading

Posted in Javascript. Tagged with , .

AngularJS – How to Create Single Page Application – Code Examples

  This article presents details on how one could create single page app using AngularJS.  You could check out this page (http://hello-angularjs.appspot.com/spa) for demo. This page is created using AngularJS and Spring MVC. It consists of notes and sample codes along with a couple of views being loaded on the same page based on different URL routes.Following is touched upon in this article for creating SPA using AngularJS. What is Single-Page application? Routing in AngularJS – Key for SPA Code Sample – Single Page App Code Sample – Routing Some of the key AngularJS concepts that got demonstrated in this article and the related demo page are following: Routing Directives Templating …

Continue reading

Posted in Javascript. Tagged with , .

AngularJS Key Concepts – Part 1

angularjs

The article represents certain key concepts of AngularJS javascript framework. I shall be writing further articles presenting my learning as I go ahead. AngularJS is a great (so-called Super-heroic) framework if you want to build single page applications (SPA) consisting of multiple views (smaller web pages so to say). That said, it is not limited to SPAs and could be used with any kind of web applications. If you have worked in past with JQuery, you would be amazed to see the simplicity that AngularJS brings on the table with respect to DOM manipulation. Just this feature has got me on board with Angular. Modular framework: Angular is a modular …

Continue reading

Posted in Javascript. Tagged with , .

AngularJS – Adding/Removing Table Rows Dynamically (Updated)

angularjs

This article is updated to include concepts and related take-away code related to adding/removing the table rows on different Angular versions including Angular 2.* and later version (Angular 4.*, Angular 5.*) and, also, AngularJS 1.* releases. Add/Delete Table Row (Angular 2.*, Angular 4.*, Angular 5.*) The code given below demonstrate the following: Display a table consisting of one or more rows with each row representing teachers’ detail Add a teacher using a Model Window Delete a teacher This is how the screenshot of the table looks like: The code is designed as following: Teacher Class: There is a teacher class (teacher.ts) which representing teachers’ detail. The code given below represents the same: …

Continue reading

Posted in Javascript, Web. Tagged with , , .

AngularJS Hello World Code Example

The article presents hello world code sample for AngularJS javascript framework. Following are important aspects to note while you are going through the Hello World demo and the code samples listed below. Directives ng-app, ng-controller, ng-model Template with double curly braces   Step 1: Include Angular Javascript within <Head> Section Include following code within <head></head> to include Angularjs javascript file. Get the latest code such as below from Google hosted libraries page. <script src=”//ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.min.js”></script>   Step 2: Apply ng-app directive to <Html> element Apply ng-app directive to <html> element such as following. Giving name of the app is optional. It could be written as simple as <html ng-app>. This directive is used to …

Continue reading

Posted in Freshers, Javascript. Tagged with , .

Things to Learn Prior to Getting Started with AngularJS

angularjs

The article represents the pre-requisites in form of topics one would want to learn to get started with AngularJS Javascript framework in a faster and effective manner, and make the learning a fulfilling experience. These are based on my own AngularJS initial experiences which was inline with the popular “deeper learning curve” associated with AngularJS.  Please feel free to suggest further items if I have missed on any of the important ones. Here is the wiki page for Angular.   I, primarily being the Java Developer, wanted to play with Angular and other related Javascript frameworks. Thus, I got on to the AngularJS website and started playing and soon found …

Continue reading

Posted in Javascript. Tagged with , , .

List of Javascript Templating Engines & Why One Needs Them?

The article presents a short overview on why one needs Javascript templating engines and, a list of these frameworks. Please feel free to suggest one or more frameworks if I missed to include them in the list below.   Why do I ever need Javascript templating engine? Consider the following use-case scenario. Let’s say, you are a big enterprise with different line of businesses (LOBs). Each LOB has a set of web applications serving its business needs. With different LOB having different applications, following scenario is likely to happen: One particular LOB, X, has applications written with Java/JSP. Other LOB, Y, has applications written with .NET technology Other LOB, Z, …

Continue reading

Posted in Javascript, Web. Tagged with .