In AngularJS when it comes to communicating between controllers, one would naturally assume to reference another controller you can simply inject it into another controller and call its methods: however, you cannot do that.
Method 1: Shared service One such method of communicating and sharing methods betweens multiple controllers is a shared service. Here you might put in a method for closing a overlay or redirecting the browser somewhere or checking the state and value of a variable.
If you have used AngularJS, or EmberJS and any other front-end Javascript based framework, then you would be familiar with the concept of data binding. Essentially being able to watch a Javascript object for changes and then call a function when this takes place.
Currently without using a third party library which implements a non-native method for observing changes in a object like Angular or a polyfill, there is no cross-browser method for observing objects for changes which doesn’t involve some kind of hack at the expense of performance.
Since the recent announcement of HTML5 being finalised, we can finally talk about all of the awesome additions to HTML5 without fear of them changing. Once such addition to HTML5 is the FileReader API which allows you to work with files locally on a hard drive.
The FileReader API is seriously undervalued and surprisingly a few developers I have spoken with who know about it, have not used it or assumed that it was not really supported and thus, ignored it. And some others have not heard about it at all.
When it comes to Javascript, there are many ways you can skin a cat as they say. When it comes to inserting HTML into a page, unless you are using a Javascript library like jQuery or something like React.js or AngularJS, you most likely are using innerHTML.
Even the html() method in jQuery internally uses the innerHTML property to insert HTML into your element(s), as do many other libraries and frameworks.
Chances are if you have been using AngularJS for a little while that you have come across $scope.$apply() at some point, whether it be your own code or someone else’s. What the heck is $scope.$apply() and why should you care?
To understand why we have $scope.$apply we have to understand that Javascript is turned based. When you write your Javascript code, it does not run all at once, code is run in blocks. So it is possible when you change a value within Angular and a $digest cycle has already been run, your changes will not be seen.
Recently in Ubuntu which I use for my hosting operating system of choice I needed to bulk change permissions on a bunch of folders and files. I needed to set permissions on folders within a WordPress installation to 755 and all files in theme, plugin and asset directories to 644.
While my command line-fu is not very strong, I was able to work it out and I thought I would share my findings here for others.
It is no secret that buying games, software, online services and electrical goods overseas in the US can cost considerably less than it does if you purchase in Australia. However there are some misconceptions about doing so.
Is the Playstation 4 region locked? First things first, the Playstation 4 console is NOT region locked. This means games from anywhere in the world will work on the Playstation 4 regardless of where you bought your console or games. This is however not the case for movies which are sometimes region locked, but who seriously buys physical forms of movies anyway?
Mac users who use Google Chrome today will receive a special treat. Chrome for Mac OS is now 64bit in the version 39 update which was pushed to the stable channel today.
Along with a whole bunch of security fixes and performance improvements, the new 64bit only version will allow for greater stability, performance and above all better security going forward.
Those who have been using the beta/alpha versions of Chrome have had 64bit support for sometime now and during testing it was reported most people saw noticeable improvements (especially when it came to video performance).
In a move signalling that Google is well and truly dedicated to improving the user experience of the web, they have announced a new tool that checks if your site is mobile friendly, as well as changes to their search results.
The tool can be found here. Fortunately all of my sites I tested were mobile friendly (including this blog).
Not only that, but Google will also be showing alongside the search results of a page whether or not it is mobile friendly as well. While it is too early to say so, whether this has an effect on the search engine rankings of websites who are and are not mobile friendly remains to be seen.
I am a longtime Uber lover and user. Without fail any trip I have taken to the United States has involved the use of Uber for getting around over hiring a car or catching a taxi.
I am currently in the US on a three month trip and for the last two months I have been using Uber almost on a daily basis. In-fact, I have racked up more Uber rides the last two months than I have in the last two years combined (which is a lot).