Wednesday, November 29, 2017

JS Mustache IF/Else

This how you set if/else in JS Mustache

test_template.mustache

//If the lists is not empty

#lists

//not empty

/lists


//Else if lists is empty

^lists

//empty

/lists

 $.get('test_template.mustache', function(template) 
var rendered = Mustache.render(template, lists: data);
$('#target').html(rendered);
);

More documentation here about JS Mustache https://github.com/janl/mustache.js/

JQuery oop blueprint basic

While working on JQuery Class I realize I need to document this code blueprint for the future purposes, just in case I'm lost :)

test_class.js

var TestClass = function($) 
'use strict';

var self = this;

//method that is bind with (self / this) is callable outside the class
self.test = function()
      console.log("This is a test");


//another public method to bind all events, click, change etc..
self.bindAll = function()

;

//private method
var privateTest = function()

;

;



Instantiate the class then call the method test
$(document).ready(function() 
var TestClassObj = new TestClass($);
TestClassObj.test();
TestClassObj.bindAll();
);

Feel free to comment below and correct me if wrong or miss something. Thanks :)

Hello world!

Welcome to my Blog. This is my first post.  :)

Monday, October 9, 2017

Announcement: This is my old site few years back

You can also visit my personal guide site here http://emisyl.com

Latest programming tuts are posted here as my guide.

I hope you can get some important programming practices posted here http://emisyl.com

Thanks

Monday, January 2, 2012

library.linode.com

One of my friend encourage me to buy linode cloud server for practice he gave me this very use-full link for newbie, a complete guide.


This guide helps me a lot, you can use this guide for your own good
 

blogger templates | Make Money Online