Last Updated: February 25, 2016
·
1.371K
· sebastialonso

Including is.js to Angular

== in JS is broken, we all know that. You'd be well served with is.js, a javascript checker library.

It's awesomely versatile and lightweight. Give it a try.
I use it all the time in my Angular projects.

First install is.js

bowe install is_js --save

and include the <script> tag.

Create a module and factory for isJs

angular.module('isJS',[])
.factory('is',function($window){
  return $window.is;
});

For your app, include the module

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

Then inject the factory where you want

app.controller('SomeController', ['is', function(is){
  is.empty({}); //true
}]);

1 Response
Add your response

You wanna say "bower install is_js --save" are'nt you ?

over 1 year ago ·

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Related Tags
#angular
#is.js
Did you know?

Angular apps often share the page with analytics and payment scripts that are not Angular modules. Those scripts execute on the same origin as the framework.

Security insights from Cside