AngularJS ngInclude directive and scope inheritance

ngInclude directive and scope

There are many times when you want to include a html snippet code from another file but preserve the scope of it. It is usually when you have different form fields for the various objects and you want to have a global controller that oversees the updating of different forms. So if you want to take the quickest route and use ngInclude directive you would be surprised that it is not properly linking to your controller and you cannot access the form instance.

This is due to ngInclude internals and how they work. ngInclude creates for each use as a new child scope so overwriting anything inside the new included HTML file content will be written into child scope and not in the one you’ve anticipated to be. So there are few workaround around this as creating a new object inside the scope for example

$scope.data = {}

inside the controlling controller and then in the imported html file set values inside the

<input type="text" ng-model="data.name"/>

This works if you don’t have a problem with static value being inserted into all html files, but if you want maximum flexibility then this is not the perfect solution. So after inspecting the source code inside ngInclude.js, I have seen a room for improvement and created a similar directive to ngInclude called ngInsert, which instead of making new child scope it inherits the current scope and continue using it inside. You can pick up the whole source code at this gist. You can use it in the same manner as existing ngInclude. Continue reading “AngularJS ngInclude directive and scope inheritance”

How to record iPhone screen

To record iPhone screen has never been easier

Developing great new iOS application requires not just a usable application, but also a great video presentation of it. How it works, basic usability tricks to make users want to get your new application which you spent numerous hours to make it perfect.

If you are working alone on next big thing or inside a small agency or team and you probably have a limited budget to outsource your video production one of the hardest parts was shooting the actual content from iOS device, whether it is iPhone or iPad. Until now you could use some kind of recording of iOS simulator or using airplay method to sync the video. It worked but it was somehow clunky experience and you needed to buy extra software.

With the release of Mac OS Yosemite version everything has changed. Now you can record you iOS device screen directly without buying additional software whatsoever. All you need to have the computer upgraded to Yosemite version and an iPhone or iPad to latest iOS 8. iOS device needs to connect to your computer through lighting cable.

Continue reading “How to record iPhone screen”

Conquering Fear

What really keeps you from living your dreams?

What problem is most dominant in peoples lives?

The answer is: FEAR!

People live every day in fear. Fear of losing their wealth, fear of losing their loved ones, fear of making the wrong decisions, fear of being themselves, fear of growing up, fear of making a commitment. The list goes on and on.

The leading cause of people not fulfilling their dreams is NOT the fear of failure – itís the fear of success! The fear of actually accomplishing what they set out to do. The fear of living life to the fullest may have paralyzed you. This will cause you to never really try in your business, or if you do try, to sabotage your efforts so you never have to face your fear of success.

Most people live their lives in the grip of this fear and they arenít even aware that it has control over them! The fear is the one thing that can turn your dreams of financial freedom, loving relationships, and a fulfilling and significant life into a pattern of habits including procrastination, self-sabotage and other bad habits.

Fear is the dominate problem in your life today. The two questions you need to answer to conquer your fear are:

Which fear has the most control over your behavior? Is it the fear of failure, the fear of rejection, the fear of success, or is it all of them?

How do I interrupt the bad habits that I have developed as a means of protection from this fear? How do I interrupt the programming I have within me?

These are the two most significant questions when it comes to overcoming your fears. If you can answer these two questions, your life will forever change!

The reality of fear is that it is human and is a part of life. Itís not going to go away. Some fear is even healthy! It is a gift given to you to keep you safe and bring you closer to your creator.

Every person is born with three instinctive fears. These are: fear of falling, fear of loud noises, and fear of abandonment. These three fears were given to you to help you monitor what is going on around you. Think about it; it is fear that gives you the adrenaline rush that makes you escape from a situation that is really, truly unsafe. It also gives you the same rush that causes you to fight to win.

Faith is born in fear. God knew in His infinite wisdom that fear is what would drive His people back to Him. Although sometimes it is only in times of extreme fear that we look to God and choose Him. Take a look at your own life and think about the times you looked to God for His power and wisdom. Those were probably times of extreme fear. True faith is born from fear!

So what caused the gift of fear to be the number one problem in society today? Why do people let fear control their actions, beliefs and lives? The answer is the difference between reacting to fear and acting in fear. It has everything to do with your belief system.

Children typically react instinctively to fear, which is appropriate behavior at this age. Most adults don’t make the distinction between reacting to fear, as when they were a child, and acting with their intellect when dealing with fear.

People react instinctively to fear by either denying it or running away from it. They miss the power that comes from acting with their intellect, never allowing the fear to become the gift it was intended to be. Learn to act with your intellect by exposing your true fears and the beliefs they represent and free yourself so you can move on with all you are meant to do, have and become!