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
}]);Written by Sebastián González
Related protips
1 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
Best
#Angular
Authors
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
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#