Thursday, December 18, 2014

JS: angular 1.3+ one-time-bindings with ng-if

So as I warned the readers, there will be javascript-related stuff in my blogs, propably as time goes by, more and more.

Now getting the angular 1.3+ one time bindings to work in my app, I had to do a lot of work. I just discovered today that my ng-ifs act weirdly with the bindings. Basically what I have often in my code, is something like this:
ng-if=" myUserData_shiftChanges[thisDay.dbFormat][siteIndex][groupIndex] && myUserData_basicData.id === userIndex"
Now that works fine, when we don't involve one time bindings, but, when it changes to this:
::( myUserData_shiftChanges[thisDay.dbFormat][siteIndex][groupIndex] && myUserData_basicData.id === userIndex )
It will create a watcher for this, eventhough it shouldn't.

I tracked the issue to angular handling ng-ifs that don't return something solid like true or false. I basically changed my code to one-line IFs, like so:
::( myUserData_shiftChanges[thisDay.dbFormat][siteIndex][groupIndex] && myUserData_basicData.id === userIndex ) ? true : false
And now they work fine again.

Tuesday, December 9, 2014

About me

I guess the easiest approach to starting blogging is to introduce myself and my motives.

Who am I?

I'm just another nerd living in Finland with a wife and 1½y old daughter. And don't even get me started with family life or how hard raising a daughter can be. I mean I thought I was ready and the universe decided to prove me wrong.

I love IT. I've always played a lot of computer games, even my closest friends consist mostly of computer gamers. And as a result of this burning passion, I also operated the Finland biggest and most successful (if somebody disagrees on the most successful part, I'll be happy to hear the arguments) gaming cafe. Those of you fools, who do not know what a gaming center is, well go google ;P. The gaming center was named Level7.

The earlier very tight relationship with gaming has later changed more and more to coding and other more useful projects. I have been coding PHP actually a very long time, if we look at a calendar. Like almost 15 years. But the actual coding time is much less. I got interested in PHP already before my entrepreneurship, but has been set to background because of it and other projects.
Later on the PHP has more and more turned to javascript as that is becoming more important when developing different applications for the internet. So I concentrate more on applications not on websites.

Why blog?

I have many many times in my life been on the situation that I wan't to actively use social media for various things. In the end, I have used some, but never as it should be used or in anyway effectively. I would love to have certain skills in life, but you use must learn to use and utilize to the fullest, what you are given in life.

A good example is multi-tasking. I can tell you that, if you lack of multi-tasking capabilities, you will notice that very fast in competitive gaming. No matter the game reflexes and multi-tasking are one of the core skills in competitive gaming.

So to get back on track. I've decided to start blogging mostly to educate myself and learn new skills.

What you are expected to see in this blog?

I will be blogging about IT technology, mostly about javascript. That is one of the things that drives me on at the moment.

Another what really drives me on are some own ideas for projects and dreams of entrepreneurship. I can tell you that becoming an entrepreneur has been easily one of the best things that have happened in my life. I got to life my dreams and do things my way. But it has a downside. After feeling the freedom you get with that, everything is in another perspective. Though being an employee is still no problem.

Due to my current situation in life with a family and my little daughter. Family life will also get it's share of this, but it will most likely be smaller share. Also wondering and talking about life and experiences in general will make their appearances.