Code Monkey home page Code Monkey logo

angular-from-0-to-1's Introduction

  • 👋 Hi, I’m @huahuadavids from shanghai, working as a front end developer from 2013.
  • 👀 I’m interested in javascript, java, Go, c#, I can work in web, mobile, desktop and so on.
  • 🌱 I’m currently learning 3d development and golang.
  • 💞️ I’m looking to for a oversea job in Australia, New zealand or USA or Canada and for an opportunity to run(润).
  • 📫 How to reach me, [email protected] or [email protected].

angular-from-0-to-1's People

Contributors

huahuadavids avatar

Stargazers

 avatar

Watchers

 avatar  avatar

angular-from-0-to-1's Issues

step001 init the scope, Scope Objects

Here , the scope of angular is a construction function that has many fns and attrs

function Scope() {
   this.$$watchers = []; 
  // the prefix $$ represents a private variable
  // the watchers in this collection
}

step002 a watcher and a $digest method

The $$watchers is a collection of the watchers , a watcher has a watchFn(return the data) and a listerFn(some opreations according to the data change)

// the function $watch , you can attach a watcher to a scope
Scope.prototype.$watch = function(watchFn, listenerFn) {
  var watcher = {
     watchFn: watchFn,
     listenerFn: listenerFn
  };
  this.$$watchers.push(watcher);
};
// $digest  iterates over all registered watchers and calls their listener functions
Scope.prototype.$digest = function() {
  _.forEach(this.$$watchers, function(watcher) {
    watcher.listenerFn();
  });
};

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.