AngularJs Partial Page Controller Code not Executing




Brief
So I setup my new web application. I'm developing a web app for Hostel Room reservation and allocation. At my frontend, I'm using a bootstrap framework powered by AngularJs. Hmm! I so much love AngularJs with the ease of use it helps me to present end users of my apps.

The Issue
I setup a controller for most of my partial pages, however, for one of the pages (clients.html) whose controller (clientCt) is in clients.js, the script doesnt run if I navigate to the page using a link. However, if I reload the entire page while on this partial page, the script would run.

Problem
I found out that statements in document ready were the ones not getting executed. So, please guys, for your controller Javascript, steer clear of that ever useful document ready block:

The Document Ready block
$(document).ready(function(){});

Solution:
I simply moved my page initialization codes outside the document ready block and pronto! Everything goes back to normal

Comments

Popular posts from this blog

Resize or Crop Image before Upload Using HTML5 File API

Exception from HRESULT: 0x80131040

Get Creative With Data Tables: Row Click Events