how to create placeholder while loading like facebook

You can make it with some css background linear-gradient: @keyframes placeHolderShimmer{ 0%{ background-position: -468px 0 } 100%{ background-position: 468px 0 } } .linear-background { animation-duration: 1s; animation-fill-mode: forwards; animation-iteration-count: infinite; animation-name: placeHolderShimmer; animation-timing-function: linear; background: #f6f7f8; background: linear-gradient(to right, #eeeeee 8%, #dddddd 18%, #eeeeee 33%); background-size: 1000px 104px; height: 338px; position: relative; overflow: hidden; } … Read more

Angular JS does not allow preventDefault or return false to work on form submission

I know I am pretty late to the party, but in case you did not figure it out yet, you can keep the action and make sure the form is not actually submitted by passing $event to the ng-submit function. Then you can use event.preventDefault(); in your controller after you do all your processing. So … Read more

ngHide or ngShow based on number of children

To add to @Josh David Miller answer, the following values are considered falsy in angular. 1)An Empty Array 2)An Empty String //Even a space is considered true 3)An Boolean with false 4)undefined 5)null 6) 0 So, David’s answer can be written as, <div ng-show=”items.length”> <div ng-repeat=”item in items”> <!– … –> </div> </div> or even … Read more

Angular Directive Different Template

Angular will accept a function as the template option, so you could do something like so: .directive(‘myDirective’, function () { return { templateUrl: function (tElement, tAttrs) { if (tAttrs) { if (tAttrs.type === ‘X’) { return ‘X-template.html’; } if (tAttrs.type === ‘Y’) { return ‘Y-template.html’; } } } } }); For more info, see the … Read more

How do I set up a Rails Angular project to test JS?

You can use teaspoon it runs your favorite test suite (default is jasmine) and they have a wiki to integrate with angular. Teaspoon integrates with the asset pipeline, so you can throw all the angular gems in there and require them in the teaspoon generated spec_helper.js. The other cool thing is: they have a guard … Read more

Access-Control-Allow-Origin and Angular.js $http

I’m new to AngularJS and I came across this CORS problem, almost lost my mind! Luckily i found a way to fix this. So here it goes…. My problem was, when I use AngularJS $resource in sending API requests I’m getting this error message XMLHttpRequest cannot load http://website.com. No ‘Access-Control-Allow-Origin’ header is present on the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)