Skip to content

Instantly share code, notes, and snippets.

@podhmo
Created January 24, 2016 00:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save podhmo/edd3dd46d75f936c9680 to your computer and use it in GitHub Desktop.
Save podhmo/edd3dd46d75f936c9680 to your computer and use it in GitHub Desktop.
var ca = require('console-angular');
function pp(e){
var s = e.toString();
var replaced = s
.replace(/class="ng-isolate-scope"/g, "@")
.replace(/class="ng-scope"/g, "*")
.replace(/class="ng-binding"/g, "%")
;
console.log(replaced);
}
ca.setup(function(angular){
var app = angular.module("app", []);
app.directive("item", function($timeout){
return {
restrict: "E",
scope: {},
bindTocontroller: {},
controller: function(){
Object.defineProperty(this, "title", {get: function(){return this._title;}});
$timeout(function(){
this._title = "updated";
}.bind(this), 20);
},
controllerAs: "c",
template: "<p>{{ ::c.title }}"
};
});
document.body.innerHTML = '<item></item>';
var injector = angular.bootstrap(document, ["app"]);
injector.get("$rootScope").$apply();
pp(angular.element(document.body).html());
setTimeout(function(){
console.log("update:");
pp(angular.element(document.body).html());
}, 30);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment