Use of $parse in angular js

Angular runs $parse automatically when it runs the $digest loop, basically $parse is the way angular evaluates expressions. If you wanted to manually parse an expression, you can inject the $parse service into a controller and call the service to do the parsing for you. Here’s a code snipped from ng-book that watches then parses … Read more

How can I convert a string to boolean in JavaScript?

Do: using the identity operator (===), which doesn’t make any implicit type conversions when the compared variables have different types. Don’t: You should probably be cautious about using these two methods for your specific needs: Any string which isn’t the empty string will evaluate to true by using them. Although they’re the cleanest methods I can think of concerning … Read more

module.exports vs exports in Node.js

Setting module.exports allows the database_module function to be called like a function when required. Simply setting exports wouldn’t allow the function to be exported because node exports the object module.exports references. The following code wouldn’t allow the user to call the function. module.js The following won’t work. The following will work if module.exports is set. console Basically node.js doesn’t export the object that exports currently references, but exports the properties … Read more

What is the difference between node.js and io.js?

io.js is a fork of Joyent’s Node.js What are the differences? io.js: Node-forward is basically being merged into io.js forked on the basis of community-driven development and active release cycles includes many of the original Node.js developers has the future goal of “merging back with Node.js” This repository began as a GitHub fork of joyent/node where contributions, releases, … Read more

How do I get an element to scroll into view, using jQuery?

Since you want to know how it works, I’ll explain it step-by-step. First you want to bind a function as the image’s click handler: That will apply the click handler to an image with id=”someImage”. If you want to do this to all images, replace ‘#someImage’ with ‘img’. Now for the actual scrolling code: Get the image offsets (relative to the … Read more