JSFiddle - React, Tailwind, and code Playground

by csbenjamin

HTML

<div ng-app="app" >
    <div ng-controller="myCtrl">
        <div ng-if="true">
            <p>Now you can see-me because the condition in ng-if is true. Change it to false and update the code!</p>
        </div>
    </div>
</div>

JavaScript

angular.module('app',[])
.directive('ngIf', function() {
    return {
        link: function(scope, element, attrs) {
            if(scope.$eval(attrs.ngIf)) {
                // remove '<div ng-if...></div>'
                element.replaceWith(element.children())
            } else {
                element.replaceWith(' ')
            }
        }
    }
});
function myCtrl($scope){
    obj1 = {
        a:false,
	    b:false
    }

    obj2 = {
    	a:true
    }
    console.log(angular.copy(obj2,obj1));
    console.log(obj1);
}