Load controller dynamically in AngularJS

If you are using routing in AngularJS then It’s very important to load controller dynamically. Otherwise, you have to load all controllers at the beginning which is not efficient.

We can load controller dynamically by resolve attribute of $routeProvider
.when function. Please have a look on sample code. Surely, You will understand that.

var app = angular.module ('hw',['ngRoute','ngResource']);
app.config(['$routeProvider', '$controllerProvider', function($routeProvider, $controllerProvider) {
app.registerCtrl = $controllerProvider.register;

function loadcontroller(controllerSubPath){
$.getScript("scripts/controllers/" + controllerSubPath + ".js").done(function( script, textStatus ) {
}).fail(function( jqxhr, settings, exception ) {
console.log( exception );

.when('/Rights',{templateUrl:'views/Right/search.html', controller:'SearchRightController', resolve: { load: function () {loadcontroller("right/searchRightController");}}})
redirectTo: '/'

Hard Working & Commitment matter

Eager to learn new things, facing problem are key to development power. Hard working, Dedication, Commitment can ship great product. Listening others, accepting different views, ideas can increase creativity. Helping mind can sharp knowledge. Small small idea can bring another idea. Exploring new things open new door of opportunity. Over the 5 years of software development experience, Now I feel these.


As a Software engineer, I worked several platform. I believe, platform depends on project and personal choice. I worked in Java, .Net, Php. Interestingly, now-a-days most of the platform following same pattern and trends. That’s why, It’s very easy to adapt with new technologies.


Earlier In my career, I worked web development where server side component used like JSF, JSP etc. Now, AngularJS won developers heart. Because, client side should not depend on server side. Seriously, Restful API is responsible for more cutting edge, excellent web application project.

However, I always believe faith is key of success. At the same time, Hard working and strong commitment can bring success with faith.


I want to engage some exciting project where I can meet gig people. Toptal is great place to work on exciting project. I want to be a part of  Toptal community.


Configure mysql datasource in wildfly 8.0

Add mysql module to wildfly application server:

1. Go to wildfly-8.0.0.Final\modules\system\layers\base\com
2. Create folder like “sql\mysql\main\” and go to sql\mysql\main\
3. Place mysql connector jar to main folder
4. Place module.xml file to main folder

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.sql.mysql">
     <resource-root path="mysql-connector-java-5.0.4-bin.jar"/>              
     <module name="javax.api"/>

Add datasource to wildfly configuration file

1. Go to C:\Program Files\wildfly-8.0.0.Final\wildfly-8.0.0.Final\standalone\configuration
2. Open standalone.xml file (we assume you are using standalone.xml as server configuration file)
3. Add following code to datasources section

	<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
	<datasource jndi-name="java:jboss/datasources/brachub" pool-name="brachub" enabled="true" use-java-context="true">
		<driver name="mysql" module="com.sql.mysql">
		<driver name="h2" module="com.h2database.h2">

Hope this will work.