Categories
Opinions

Coding Activities for Week 25 2017

Looking at the above graph, It’s good that I am keeping the goal of spending 3 hours purely on coding. Well my tracker doesn’t track the time that is spend on debugging/researching a particular problem.

week 27 2017 languages usedFor this week I switched back to the Ionic. Which is also build on top of Angular. As angular has a choice to use JavaScript but I am using Typescript that’s why Typescript has 41.34% of the pie chart. Half of the coding is through HTML which is because angular allows us to link separate template file. I tend to write html inline when it’s small. It does feels organized when everything is written in one component.ts file. I am not in favor of writing separate css for each component because it’s injected as embedded css when compiled. Where is the concept of separation of concerns when css is injected in the body of html.

Things Learned

Access Modifiers in Constructor Function

In Angular 2* we use a typescript convention known as constructor assignment. In order to use a service or library, we need pass a reference to library as a parameter in our constructor. We need to inject the service in the constructor. Without providing any access modifier, the reference will be function scoped limited to that of constructor function.

without access modifier constructor assignment typescript
Constructor Assignment without any access modifier complains for missing property.

If you provide the access modifier while passing parameters than the parameter will be class scoped i-e will be considered the member of the class.

constructor assignment with access modifier
Giving any access modifier will promote the reference to class member

Things Discovered

  1. There is no way to remove grey border around broken image in webkit. The only way to fix it, is to hide the broken image entirely as
    img:not([src]){ display:none; visibility: hidden; }
    
  2. We can style the broken image with the way we want using Pseudo Elements. You can add custom message or custom placeholder image.
  3. In fact all the class members are public unless they are specified public.

Conclusion

That’s all I have to share from this week of my work log. I hope you have learned a thing or two. I would like to know how you have spend you last work week.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.