Last office week of Ramadan, at office I was waiting for Azure Remote app to import the disk image. It will take about 30 mins while everyone went for lunch. Yes, just a minute before I have published my third Google chrome extension, Switch to Google while I was alone with the PC. It employs chrome.pageAction API to put the icon on addressbar for a partucular URL.
Sometimes this doesn’t make sense, why I have to use this? but for me, my default search engine is Bing for no reason and I find good search results there also, for some instances I have to come back to Google, and I was using a small trick there. Bing searches with
http://www.bing.com/search?q=this+is+a+search while Google also follows the same thing
https://www.google.com/search?q=this+is+a+search so I manually replace
More technically, the manifest file goes like
This points to a
background.js file which looks like
The code is pretty much clear and I am doing the same replace thing with the help of this JS.
Disclaimer : This blog post is case sensitive.
Angular is replacing hard coded Ajax these days and its been a very good option as a jQuary alternatively. Honestly Angular and jQuery are two different things, Angular is a framework whole jQuery functions as a library, they have separate functionalities but most people who were depending on jQuery for everything is now coming to Angular because of some good builtin things in Angular such as templating, data binding and routing capabilities in single page apps.
I am not an Angular fanatic, but trying and experimenting something so I can learn the things. In this blog I am going to discuss about a Google Instant search like implementation in Angular
This is a very simple HTML code I got from W3Schools and added some modifications. What this does is… TRY IT 🙂
Lets have a look at the code. Here I have a controller
customersCtrl for the app
myApp. The functionality of the controller is to fetch results from the URL
http://www.w3schools.com/angular/customers.php go to the page and see how its formatted. This is how Angular fetch and decode JSON. The method we are using is
$http.get. In case you are wondering what is an
$http. Angular has a good documentation for it. On
success callback on
$http.get the controller created an application object property
$scope is the application object and
$scope.names is its property which stores names which contains the
records from the response we get from the
Now lets move to the DOM manipulation, typically we call it a View. There what happens is, we put a repeater with
ng-repeat which repeats the items from
names this is the same property that was previosuly
$scope.names and its filtered with
ng-model which is
name which gets the
Name from the
response. Finally it will list
Country which have the
Try this code and try to implement your own, so you will get a very clear picture.