Simplifying AngularJS in 60 minutes: Webinar recap

Dhananjay Kumar / Tuesday, March 31, 2015

We recently held a webinar for the Indian region on March 27th, titled “Simplifying AngularJS in 60 minutes”.

The presentation was attended by good number of developers from the Indian region, where host Microsoft MVP and Infragistics Consultant Dhananjay Kumar covered a range of topics, including:

  1. Getting started with AngularJS in Visual Studio
  2. Setting up NodeJS, ExpressJS, Sublime Text using Bower for AngularJS development (for more information on this topic,  you can see Dhananjay’s post about it here
  3. $Scope object, $rootScope object
  4. Controller and Controller hierarchy
  5. Services , $http service, and writing custom services
  6. CRUD operations using a WCF REST Service

You can access the presentation slides here.

Many questions were asked during the webinar, and while we tried to answer all of them, we may have missed some, so here are some of the important questions, followed by our answers:

Can we use AngularJS with PHP?

AngularJS can be used with any server side technologies like PHP, ASP.NET, and ASP.NET MVC etc.

Can we work with AngularJS on notepad?  

Yes you can do AngularJS development on any text editor like Notepad, Sublime text, and Notepad++ etc.

What is $scope object in AngularJS

In AnguarJS each controller has its own $scope object. Using the $scope object controller to pass data and behavior to the view. $scope object connects controller and view in  AngularJS.

What do you mean by constructor in JavaScript?

In JavaScript a function is known as function constructor, which object gets created whenever we use it. In AngularJS the controller is a JavaScript constructor function because whenever we use a controller, its object gets created.


var AuthorApp = angular.module(''AuthorApp,[]) is both side name should be same?

No, it is not mandatory to have the same name.

How do you rend Data from the Backend Database in the AngularJS?

You can do so using the following steps:

  1. Write HTTP enabled service like WCF REST or Web API to perform CRUD operation on the database.
  2. Create a custom AngularJS service either using factory method or service method. Use the $http service to make a call to the REST service or Web API
  3. Use custom service in the controller by injecting service module in the controller module
  4. Attach returned data from the service to the controller $scope object
  5. Use the controller $scope at on the view and render the data from the database.

 

How can I get the value of parent controller values inside the child controller in the case both have same value

You can use $scope.$parent.propertyname in the controller and on the view {{$parent.parentpropertyname}}


What will happen if both parent and child control have same properties?

Child controller will override the parent controller property.

How two controllers can share data with each other?

In AngularJS controllers can share data using the service.

If services are singletons, can we use them to create a Cache mechanism for an application, where data from REST service calls are cached and made available to all controllers by just injecting that service?

Yes you can use service to cache data and share across the application.

Once again, thank you so much for your interest in our webinars – and we look forward to seeing you at a future webinar!