Detailed Explanation of How angularJS working

Published on

Detailed Explanation of  AngularJS and How its working? Definition of AngularJS as put by its official documentation is as follows: “AngularJS is a structural framework for dynamic web apps. It lets you use HTML as your template language and lets you extend HTML’s syntax to express your application’s components clearly and succinctly. Angular’s data binding … Continue reading Detailed Explanation of How angularJS working

How the (DI) Dependency Injection work in Angular2

Published on

How the (DI) Dependency Injection work in Angular2? Dependency injection in Angular2 relies on hierarchical injectors that are linked to the tree of components. This means that you can configure providers at different levels: For the whole application when bootstrapping it. In this cases, all sub injectors (the component ones) will see this provider and … Continue reading How the (DI) Dependency Injection work in Angular2

‘argument ‘FirstCtrl’ is not a function, got undefined’.

Published on

You have to specify the name in ng-app directives in your html. Lose the one in your div. Update Let’s try a different approach. Define a module in your js file and assign the ng-appdirective to it. After that, define the controller like an ng component, not as a simple function: <div ng-app=”myAppName”><! — or what’s … Continue reading ‘argument ‘FirstCtrl’ is not a function, got undefined’.

Differences between Service, Provider and Factory in AngularJS?

Published on

TL;DR 1) When you’re using a Factory you create an object, add properties to it, then return that same object. When you pass this factory into your controller, those properties on the object will now be available in that controller through your factory. app.controller(‘myFactoryCtrl’, function($scope, myFactory){ $scope.artist = myFactory.getArtist(); }); app.factory(‘myFactory’, function(){ var _artist = … Continue reading Differences between Service, Provider and Factory in AngularJS?

How to check if checkbox is checked using angularjs or javascript

Published on

checked is boolean property so you can directly use it in IF condition:- <script type=text/javascript> function validateCk(){ if (document.getElementById(‘remember’).checked){ alert(“checked”);} else{ alert(“You didn’t check it! Let me check it for you.”)}} </script> <input id=”remember” name=”remember” type=”checkbox” onclick=”validateCk()” />

How to cache an http get service in angularjs?

Published on

Angular’s $http has a cache built in. Just set cache to true in its options: $http.get(url, { cache: true}).success(…); or $http({ cache: true, url: url, method: ‘GET’}).success(…); Or you can implement it yourself using $cacheFactory (especially handly when using $resource): var cache = $cacheFactory(‘myCache’); var data = cache.get(someKey); if (!data) { $http.get(url).success(function(result) { data = … Continue reading How to cache an http get service in angularjs?

Angularjs autocomplete from $http request

Published on

An autocomplete directive and uploaded it to GitHub. It should also be able to handle data from an HTTP-Request. Here’s the demo: http://justgoscha.github.io/allmighty-autocomplete/ And here the documentation and repository: https://github.com/JustGoscha/allmighty-autocomplete So basically you have to return a promise when you want to get data from an HTTP request, that gets resolved when the data is … Continue reading Angularjs autocomplete from $http request

Huge number of files generated for AngularJS 2 project

Published on

There is nothing wrong with your configuration. Angular 2 uses npm modules and dependencies for development. That’s the sole reason you are seeing such a huge number of files. A basic setup of Angular 2 contains transpiler, typings dependencies which are essential for development purposes only. Once you are done with development, all you will … Continue reading Huge number of files generated for AngularJS 2 project