Converting www.vinaytripathi.com which is written in ASP.NET to AngularJS, Bootstrap and HTML 5 www.vinaytripathi.com/AngularJS
10:56 pm - Started the process.
10:57 pm - Downloaded the AngularJS from http://angularjs.org/ version1.2.14
That has downloaded angular.min.js on my laptop
Next step, let get a bootstrap theme so save me time for designing
11:02 pm - Ok, bootstrap theme decided and download, next step is to setup source control and add the theme to the bit bucket :)
11:08 - Ok done, the files are in source control and I have checked in as an initial version.
Btw, did I mention that South Africa are actually doing quite well in test match against Australia, looks like they will take it to the wire.
11:11 - tossing up between using visual studio as an editor or just notepad++…… …….
……………
11:12 - Visual Studio 2013 it is :).. WhyjQuery15206106200215872377_1394033917359 Just because I can :)
11:16 - Looks like the theme has some pre-defined, images, I would need to clean those up… taking a lean approach, I am just going to have a basic page with one menu item and I am going to write the test and get it deployed.
11:17 - Oh sorry, forgot that I need to add angular js file to the project as well.
11:28 - ok so what do I have.. A base bootstrap website with no use of angular yet
11:29 - Time to do some angular changes, going to set a basic MVC structure
11:36 - This is how my control now looks
11:37 - Time to enable angular in webpage (btw, the controllers.js reside in js directory)
11:39 - oops my VS crashed with inconsistent line count error jQuery152025846507120877504_1394034777182? I am glad I had saved my code just before :)
11:40 - back in business… included angular.min.js in the page
Now let's tell the page that we are going to be using AngularJS
Notice that I have included ng-app directive at body level, that is because at this stage I am only going to be using angular directive inside body, not in title or before body
Now its time to replace some hard coding with model data (yes I know its still hard coded in controller, we'll get to it later)
I have included controllers.js in page as well
11:55 - Ok, so something is missing, my scope field is not getting picked up by page… time to write some test and debug
PS: Australia need 3 more wickets to win series 2-1
I am going to add a directory called test under root
I would need to install karma and going to write test using Jasmine's BDD framework
I have created karma.js into config directory
Little configuration required for karma, after config, this is how it looks
Its also a good idea to include a batch file to execute the test, so I am going to create a batch file under script folder which I can run again and again
Looks like I forgot to install the karma plugin, so this is what I got when I run test.bat
Btw, test.bat looks like this
Will also need some plugins to be installed, I need to run the following command in my powershell windows
npm install karma-junit-reporter
Now I can start the karma webserver
12:24 am - ok so my Karma webserver has started
But there are some errors -
Well that is because I don't have any tests :)
So let's add some test
So it seems like as soon as I added test and fixed a problem with path in my karma config file, the tests are executed automatically, nice!!
So my test is failing, but whyjQuery15207938427641056478_1394034964079 Let's debug
Looks like the problem is with my module
So here is my problem, I didn’t had module defined
Ok, so let's define it
Hmm… so once I have defined the module name in my index.html, my website seems to pick the scope property but my test is still failing, what am I missing?
2:00 am - phew.. Finally able to get the unit test to work. Couldn't quite work out what was missing from the error message and after sometime and few tries, manage to solve the missing dependency and its all working. Looking back, I should have looked at that dependency first :)
2:02 am - My website is configured to use angular, the page is binded to controller and its scope, the unit test is working as well, let see if I can get it deployed to server :)
2:10 - Started the publish process, not too long to go :)
3:05 - Site published... off to bed now :) http://www.vinaytripathi.com/AngularJS
BTW, Australia has won the test match as well :)