AngularJS directive multiple element

How to get AngularJS directive multiple element

You probably know there exists opening ng-repeat-start and finishing directive ng-repeat-end like:

<ul>
 <li ng-repeat-start="user in users">
   {{user.firstName}}
 </li>
 <li ng-repeat-end>
   {{user.firstName}}
 </li>
</ul>

You would think it is a specially made directive that works that way but actually it is not. It is part of any directive so you can use it inside your too. When you create new directory and inside you factory function you need to return an object with multiElement options set to true. This way it will behave same as ngRepeat directive over multiple non nested fields. Small excerpt from ngRepeat.js file denoting this:

var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
  ...
  return {
    restrict: 'A',
    <strong>multiElement: true,</strong>
    transclude: 'element',
    priority: 1000,
    terminal: true,
    ...
   }
}];

From native angularJS directive there are few more directives that support multi element spanning. They are ngIf, ngShow, ngHide and ngSwitch. So by adding multiElement to your custom directive you can make to transclude over angularjs directive multiple elements at the same time. This also comes handy because you can do nesting of multiple elements if they are contained inside another one.

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”

AngularJS and Ruby on Rails work together

Finding the best integration of AngularJS and Ruby on Rails

Recently I got really excited with AngularJS so to make it work perfectly with Ruby on Rails there are some configurations needed. There are available blog posts on how to integrate it perfectly but somehow I wasn’t happy with the available preferences. Some offered to add the javascript files manually to the project and to manual project organization, others offered some kind of gem packager or even automated as a rails app template.

My goal is to describe how to start new rails app project from the scratch but the instructions should be succinct enough to be able to reuse them for the existing project (Actually I did extract it from the existing application I am working on). For the front end development I recently discovered great gem that really can make it more closer to pure full stack javascript development.
Bower is a great javascript package manager by the people who are working on Twitter Boostrap. It is like Bundler but made for javascript instead of ruby language. When I found out that there is a ruby gem that is integrated with rake tasks so I can easily update all javascript libraries without needing adding gem library for each one. The gem is called bower-rails.

My initial plan is to evolve this post into a series of blog posts on how to develop a fully functional demo application so I’ve included some steps that are might not needed but are good to have. Don’t worry I will provide explanation why I am using each of them.
Here is my plan what I will try to achieve with this series of posts:

  • creating a new demo project with angularJS from scratch, showing all my changes along the way, and trying to explain every step. this will include creating basic rails 4 app
  • adding basic gems
  • setup front end development with Bower
  • adding angularJS
  • implementing basic Rails and AngularJS controllers

Continue reading “AngularJS and Ruby on Rails work together”

Four Questions About Leadership

I hear four questions asked about leadership often. This article gives a short answer to each of these important questions.

Why Does Leadership Matter?

Parents universally hope that their children develop leadership qualities. They know that leaders are people who are effective in what they do, are respected by others, and typically rewarded for those skills in a variety of ways. It is in these formative years that, through our parents, we first see leadership as desirable and important.

As young people we look up to people around us that motivate and listen to us people that seem like real-life heroes. We consider these people leaders.

As we grow we begin to relate leaders to their jobs and ministers, teachers, police officers. And later Mayors, Presidents, and CEO’s…

As adults all of these thoughts and experiences define why we think leaders have desirable traits and play roles we admire (and why we desire these things for our children).

All of these experiences and thoughts help us define why leadership matters and it matters because leaders make a difference and can shape the future. It matters because leaders are valued and valuable. In everyone’s mind leadership, especially when it is good, matters. Continue reading “Four Questions About Leadership”

Ambitions

I aim to become the president of my country. I have the object of becoming the greatest scientist. I will one day be the richest person in the world. I aim to and so goes the list of ambitions of people. Nobody remembers that the final goal for each one of us is going back to earth. Let us talk more about ambitions.

Are ambitions good or bad? This is difficult to answer, isn’t it? To be an ambitious person must be very good. With ambitions a person strives to achieve a great feat. Few of us have very big ambitions and few very small. It all depends on our contentment. What will make us feel happy? What will make us feel worthy, and what will make us feel powerful? It’s all about what we want from life. If you want money at any cost, you will compromise with all other values and try to make more money. But if your ambition is to become an honest person and live a God fearing life, no amount of money can attract you to do any wrongs.

Ambitions therefore depend upon our character, culture, mental makeup, outlook, values and so on. Till our ambitions don’t trouble others it is ok. If by achieving our goals, we make others happy, that is still better. But if our ambitions hurt others, we must revisit our thinking and redefine our ambitions.

How to be success

You may be smart, you may be talented, you may be handsome, but you aren’t successful. After all, the guy that never was that gifted or never had great ideas and he has less brains than you, is now your supervisor!

How did that happen? Why do all of us with the knack to be great, never saw our dreams come true? And what is the common characteristic between successful people?

According to statistical researches, what divides successful people from non-successful is that the former had a particular goal in their life and worked hard to achieve it. On the contrary, people that had many goals and ideas, but spent more time talking about them than working on them, never managed to make their dreams come true. Continue reading “How to be success”

Why Setting Personal Goals Is Important

A lot of people like to learn how to be successful. They read books, listen to audio cassettes or even watch videos that tell them how to be successful in life. However most people fail to apply that knowledge, and as a result a lot of what they learn is ultimately wasted.

I know I am guilty of this myself. I once learnt about the importance of setting personal goals, but never applied that knowledge. For some reason I studied it, became interested in it, but took it no further. But later I then heard an expression that changed the way I looked at and ultimately used information I acquired.

That expression was, ìwhat’s the pointing of learning something, if you never use itî. As soon as I heard that saying, I realized that I had been learning lots of things, but never applying them in my life. Learning how to set goals, was one of those things.

So Why Is Goal Setting Important Anyway?

Taking the time to sit down and write out your personal goals is perhaps one of the most important things you can do for yourself. And incidentally, all successful people set themselves goals. That in itself should be a big enough reason to set them!

What Are Goals?

Goals are simply the things you want to do in life, and by writing them down you can clarify exactly what you want and how you are going to accomplish them.

Most people have a vague idea of what they want to achieve in life, and keep these vague ideas in their head. However, because they are vague ideas the action they take to accomplish those goals is also vague. And as a result, usually ineffective.

Personal Goals Will Focus The Mind

So writing down goals on a piece of paper allows you to decide exactly what you want to do in life. Once you know what you want to do, you can then create a specific plan of action to accomplish those goals.

It’s like giving yourself a map and compass to reach a certain destination in life. Without that map and compass you would most likely loose your way, and never get to where you want to go.

This is the real value of goals, as they help to give your life meaning, direction and a sense of purpose. With these things will also come a sense of control, which will also make you feel happier with yourself. You will be steering your life in the direction you want it to go, rather than being blown around like a leaf in the wind.

Set Yourself Some Goals!

So take some time to think about the things you want to accomplish in life. Write them down on a piece of paper, and create a plan as to how you will achieve those goals. It might just be the most important and valuable exercise you ever do.

 

Breaking Bad Habits Of Failure

People living today are extremely lucky. 50 years ago the internet never even existed, and cable TV was something you read about in sci-fi magazines. Now, thanks to the internet, you can find information on virtually anything you want, instantly. Something which was only a dream just 10 years ago.

Yet with all this information available to us, people still fail to become successful in life. Why is this? After all, there is so much self help information available telling us how to be successful, but most people still fail to achieve success. And why do people still suffer from depression, when there are so many books telling them how to live a great life?

The fact is, information is not the problem. And no matter how much technology advances, people will always have the same problems.

What Are The Reasons People Fail To Achieve Success?

If you ask someone why they never succeeded in what they were trying to do, they will most likely tell you it was someone elseís fault, or something happened that was beyond their control. However if you compare that persons life against someone else’s life, you could probably find many examples of people who suffered under far worse conditions yet still became a success.

This shows us that the real reason people fail is not because of something outside of them, rather the reason lies within.

Internal Reasons For Failure

When you continue to do the same thing over and over again it is called a habit. You are probably familiar with bad habits such as smoking, but are you familiar with the habits of failure or the habits of success?

 

Creating Habits Of Success

Since success or failure is ultimately achieved through the actions you take, habits therefore play a tremendous role in determining whether you will achieve success or failure in life. For example. If you read everyday, that is a habit. This habit is likely to expand your knowledge of a subject, and vastly improve the chances you will master and be successful at it.

However, let’s say that instead of reading everyday, you prefer to sit down and watch TV for a few hours. Do you think this will help you master any subject? Or become an expert in your field? In all likelihood, the answer will be no.

So if you look at achieving success or failure in terms of the actions you repeat on a daily basis, then it is quite simple to understand why some people succeed, and others complain of failure. People who are successful continually do things on a daily basis that will increase their chances of success. Whilst unsuccessful people do not.

This does not mean successful people never fail, they do. But what they don’t do is give up, because they have developed habits of success.

Change Your Habits!

The message you should take away from this article is that in order to experience change in your life you must first identify your habits. Think about what do you do on a daily basis, and ask yourself if those things help you achieve what you want in life?

If the answer is no, you must then change those habits, because by doing the same thing over and over again you will only get the same results over and over again.