How do JavaScript closures work?

Published on

How do JavaScript closures work? How to understand closures in Javascript? What is a closure in javascript? Understand JavaScript Closures With Ease. How would you explain JavaScript closures to someone with a knowledge of the concepts they consist of (for example functions, variables and the like), but does not understand closures themselves? JavaScript Closures for Beginners … Continue reading How do JavaScript closures work?

How to convert Highlighted or Selected text to speech

Published on

How to convert selected text to speech? How to convert Highlighted text to speech? Text to speech in HTML5 ,JavaScript which runs on all browser. Selected text to speech which runs on all browser.Text to speech using Javascript.Text to speech using jquery. HTML: <!DOCTYPE html> <html lang=”en” xmlns=”http://www.w3.org/1999/xhtml”> <head> <meta charset=”utf-8″ /> <script> var text = ”; … Continue reading How to convert Highlighted or Selected text to speech

How to get the Highlighted/Selected text in a paragraph of a website

Published on

How to get the Highlighted/Selected text in a paragraph of a website using Javascript? On Text Highlight Event? Getting the text the user has selected is relatively simple. There’s no benefit to be gained by involving jQuery since you need nothing other than the window and document objects. function getSelectionText() { var text = “”; … Continue reading How to get the Highlighted/Selected text in a paragraph of a website

Trying to Run “npm start” fails due to some error

Published on

Trying to run “npm start” fails due to some error. npm ERR! Failed at the angular-quickstart@1.0.0 start script   In package.json, I changed “@types/selenium-webdriver”: “^2.53.33” to “@types/selenium-webdriver”: “2.53.33” It compiles the TypeScript now. Looks like there was an update published today that broke something. https://www.npmjs.com/package/@types/selenium-webdriver

How the (DI) Dependency Injection work in Angular2

Published on

How the (DI) Dependency Injection work in Angular2? Angular 2 Dependency Injection 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 … 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?