Load the data before initializing the component - angular 2

My App.component which calls a init method in my user service. ngOnInit(){ this.init(true).then(data => { console.log("OnInit Called") }) } User.service returns a promise which in turn calls the account.init init = (isRegistered) => { retu

How can I generate dates from a certain Gregorian year in Hijri

I want to make an auto adaptation or generation of days of year, from Gregorian to Hijri. I mean that you want to select or write the year as example: select 2015: Get all the days of 2015 in Gregorian and then its convert to Hijrim and present the l

Lodash _.result () default value

Why doesn't lodash result method return the default value in this case? Arguments object (Object): The object to query. key (string): The key of the property to resolve. [defaultValue] (*): The value returned if the property value resolves to undefin

Create dynamic checkboxes by iterating JSONArray in DOJO

I am new to DOJO and I am using DOJO 1.5.0 version. I want to create dynamic checkboxes by iterating JSONArray in DOJO. This dynamic creation will be done on a particular event like when we selecting some combo-box value. For example consider below J

Control the audio speed of an mp3 file

I would like to play a mp3 soundtrack on my website, and manipulate the speed of the soundtrack by a percentage using a slider. I'm wondering how this could be done with only HTML(5) and JavaScript. I haven't been able to find any examples or tutoria

How can I loop this JSON?

I have the following JSON returned from a PHP script var data ={ "first thing" :["1","2"], "second thing" :["5","7"], "third thing" :["8","2"] }; I know that I can a

Wrap everything from certain div to certain div

I have a blog style layout in a cms so there are multiple instances of these divs. This is the structure: <div class="sfpostContent"> <p>Some text</p> random text <p>Some text</p> <div class="sfpostsList-img

Disable / Non-Clickable HTML HTML Button

I have following HTML scippet for a button: HTML: <div class="Clear" title="Clear"> <div class="ClearButton"> <button id="reset" type="reset" title="Clear Photos"> </button&g

Use JQuery Ajax to load the static html page into a div tag

I got this working but I need a default page showing before you choose one, how do I do this? Also is it possible to hide the page files? So it will not show when you View Source. <script src="http://code.jquery.com/jquery-1.4.min.js" type=&q

How to put the mark on google maps?

How do I put the place mark on google maps? The code below shows only particular location but I want to add my custom place mark image on google maps. <!DOCTYPE html> <html> <head> <script src="http://maps.googleapis.com/maps/api

Date up to April 1, 2013 instead of March 31, 2013

I have these two functions that creates a new string in the correct format (mm-dd-yyyy) but right now it seems to not work so well... when I input the date 31-03-2013 which is a valid date, it comes out with 04-01-2013 as in the first of the month af

Several radio buttons ajax post

I'm new in web programming and I really need your help. I have a form with several radio buttons and I want to insert them into mysql through an ajax post. I can do it for a single button but for more than one I don't have idea how to do it. This is

how to animate a bar chart from bottom to top?

I am trying to make a bar chart and the bar animates from top to bottom right now, but I want it to animate from bottom to top. How do I get it go from bottom to top? CSS .bar { width:50px; height:250px; list-style-type:none; } .bar p { background-co

Auto height of the text box for multiple text boxes

Background: I'm making a facebook wall-alike page, which will have many posts and you should be able to comment every post. And these textboxes, where you post type your comment in, should resize as in Facebook. I have this code so far. It works but

Dynamic Google plus a +1 button (with URL change)

I have a website with a photo gallery and i want the plus one button to point to the photo page and not to the gallery itself, meaning that i will need to change it dynamically when the user flips through images. What would be the proper way of doing

Do I need $ (document) .ready (function () {})?

I've been developing in javascript for a few months and I have been using $(document).ready(function(){ at the beginning of all my scripts. I've noticed other folks don't use this in their scripts but I can't seem to get mine working without it. I'd

find the length of the visible / hidden list items faster

I am a jquery newbie and have been adding alert timestamps into my html file to find what lines of code are making things slow. I have found the main bottleneck and am looking for help to know how to change these 2 lines to be faster. My html file ha

Sencha touch: How to refresh the input label

I have an Ext.form.Select that I want to update it's label dynamically when it's value changes. Simple as it sounds, it refuses to work: var musicInCarInput = new Ext.form.Select({ options: [ {text: "Yes", value: "yes"}, {text: "M

Javascript - assign dynamic values ​​without eval ()

So, I have 3 variables being passed in: stats (JSON object, shown below) place_type (string, either "US" or "State") factor (string) I have another variable, answer, whose value depends on the other variables. For example, if place_typ

add a delay in a javascript function for a fade effect

I'm looking to make a website that slowly fades in to hide the loading of the images. Now I've managed to get some javascript that does the fade in but it starts immediatly when the page loads so you still see the individual elements loading when you

jQuery equivalent of YUI StyleSheet Utility?

Does jQuery - or one of it's plugins - have equivalent functionality to the YUI StyleSheet Utility? "The StyleSheet Utility is capable of creating new stylesheets from scratch as well as modifying the existing stylesheets held as properties of elemen

Auto Slider / Scroller to display dynamic content

Can any one tell me how can i implement a auto slider/scroller in my web page. The slider should show dynamic data from a database. (Ex : Hot jobs tab in the plipl.com site's home page (www.plipl.com) . Is there any easy way to do this with jQuery ?T