Learning AngularJS and use it with ASP.Net MVC – Controller on MVC view

I’ve been using book Build Single Page Application with ASP.Net MVC 5 and AngularJS.

On chapter 4, at Creating first angular controller, book’s code didn’t work in my case. I’m using Angular version 1.3.15.

I had to make following changes:

At _Layout.cshtml, identify the app:

<html ng-app=”myApp”>

At homeIndex.js (the file storing the angular controller definition):


var app = angular.module(myApp, []);

app.controller(‘homeIndexController’, function ($scope) {

$scope.fname = “John”;

$scope.lname = “Doe”;



And at the view, from where the angular controller is supposed to be called, Index.cshtml:

@section scripts


<script src=”~/js/homeIndex.js”></script>


<div ng-app=”myApp” ng-controller=”homeIndexController”>

Fname:- {{fname}} <br />

Lname:- {{lname}}


Will write this comment at Amazon too. Either AngularJS has changed since the version author was using (he says it is 1.2.26 or there may be some errors on sample code at the book.


Timeout issue at Azure Scheduler

Found an issue on implementing service execution using Windows Azure Scheduler. The triggered call is a long running one. Scheduler times-out after 60 seconds, as waiting for response to request made by the job.

The solution I came out with, for my situation, was to modify service code (Web API), making method call asynchronous, so execution of the action method called by Scheduler job request continues and finished on time.

This is the code I used for calling the method asynchronously, at the Web API action method:

Task.Factory.StartNew(() => MyMethodClass.MyStaticMethod(parameter));

Details: http://social.msdn.microsoft.com/Forums/en-US/46f56a6f-204a-416f-b267-b558dbeeffa2/how-to-change-the-timeout-for-azure-scheduler-job?forum=azurescheduler



Starting the year – Improvement through creativity

First post for 2014. I made my New Year’s resolutions, professional field, creating great software with Zgura:

  1. Learn, get certified for Web development, exams 70-480, 70-486 and 70-487 link
  2. Apply SOLID development principles
  3. Always try to improve through creativity

On 3, I’d like to comment on the ideas expressed at Fareed Zakaria GPS program, in an interview to Elon Musk GPS link, summarizing, people working at his company must not just develop technology, they must improve on what has been developed. Just doing one work is not enough, need to improve on existent work.

As such, I’d like to share on an improvement I just implemented, developing on work already done by my colleagues at Zgura:

As we develop ASP.Net MVC apps and deploy continuously from Git into Azure Websites, one website for each stage of development and branch on source control (i.e., development, test, production) we wanted to set and use configuration environment variables for between other things, connection strings to databases, in Azure Websites and get them from Environment variables, using:

public static string ConnectionString
                return Environment.GetEnvironmentVariable("APPSETTING_ConnectionString,"varname");

But after implementing that, we had an issue when trying to do local debugging as the application doesn’t have access to the environment variables repository. A solution I found was to add that variables at Application_Start, under Global.asax.cs:





As per a comment from my friend Salvador Aguilar, I’d like to show a screenshot of deployment configuration into Azure websites.

Continuous Deployment Azure

Styling for jquery UI in MVC 4

This is going to be a very short post: I was having an issue with the DatePicker from jquery UI: widget was appearing without any style, I found I was missing  references for jquery UI css at BundleConfig:

var jqueryUI=new StyleBundle("~/Content/themes/base/css").Include(

Then, you add the following code at your _Layout View:


At the beginning I added jquery.ui.theme.css, after that, I was getting the DatePicker like this:

Do you see the weird characters? it solved when I changed the referenced css file for: jquery.ui.all.css at BundleConfig.cs. Now it looks like:


Happy weekend.