JSFiddle

  • angular forms

    AngularJS 1.2.1, HTML, CSS, JavaScript

    <div ng-app>
            
        <form name="myForm">
            <input type="text" ng-model="myForm.firstName" required />
            <input type="text" ng-model="myForm.lastName" required />
        </form>
        
        valid: {{myForm.$valid}}
        dirty: {{myForm.$dirty}}
        
        <button ng-click="myForm.$setPristine()">set pristine</button>
            
    </div>
  • javascript prototype inheritance

    jQuery 2.0.2, HTML, CSS, JavaScript

    Object.prototype.inherit = function(base) {
        this.prototype = new base();
        this.prototype.constructor = this;
    };
    
    function MyBase(message){ 
    	this.message = message;
        
        this ...