Javascript span innerhtml not updating

10 Feb

It’s how Angular constructs a page, in contrast to the older style of web-database application servers like PHP, ASP.NET or Coldfusion, where the back-end server calculates would what the page should look like based on the URL and send back a pre-digested chunk of HTML (perhaps with relatively minor javascript thrown in for enhanced interactivity).

*/ /** * Tetris Game * Initializes the buttons automatically, no additional actions required * * Score: * 1) puzzle speed = 80 700/level * 2) if puzzles created in current level = 10 level*2 then increase level * 3) after puzzle falling score is increased by 1000*level*lines Removed * 4) each down action increases score by 5 level * * API: * * public - method can be called outside of the object * event - method is used as event, "this" refers to html object, "self" refers to javascript object * * class Tetris * ------------ * public event void start() * public event void reset() * public event void game Over() * public event void up() * public event void down() * public event void left() * public event void right() * public event void space() * * class Window * ------------ * event void activate() * event void close() * public bool is Active() * * class Keyboard * -------------- * public void set(int key, function func) * event void event(object e) * * class Stats * ----------- * public void start() * public void stop() * public void reset() * public event void inc Time() * public void set Score(int i) * public void set Level(int i) * public void set Lines(int i) * public void set Puzzles(int i) * public void set Actions(int i) * public int get Score() * public int get Level() * public int get Lines() * public int get Puzzles() * public int get Actions() * * class Area * ---------- * public Constructor(int unit, int x, int y, string id) * public void destroy() * public int remove Full Lines() * public bool is Line Full(int y) * public void remove Line(int y) * public mixed get Block(int y, int x) * public void add Element(html Object el) * * class Puzzle * ------------ * public Constructor(object area) * public void reset() * public bool is Running() * public bool is Stopped() * public int get X() * public int get Y() * public bool may Place() * public void place() * public void destroy() * private array create Empty Puzzle(int y, int x) * event void fall Down() * public event void force Move Down() * public void stop() * public bool may Rotate() * public void rotate() * public bool may Move Down() * public void move Down() * public bool may Move Left() * public void move Left() * public bool may Move Right() * public void move Right() * * class Highscores * ---------------- * public Constructor(maxscores) * public void load() * public void save() * public bool may Add(int score) * public void add(string name, int score) * public array get Scores() * public string to Html() * private void sort() * * class Cookie * ------------ * public string get(string name) * public void set(string name, string value, int seconds, string path, string domain, bool secure) * public void del(string name) * * TODO: * Element By Id("tetris-nextpuzzle") cache ?

Along the way, you take a look at how to access text nodes in the DOM, and how to set an on Load event handler.

One of the great things about Java Script is that it lets you manipulate the contents of a Web page in real-time.

From a programming perspective, there are many possible ways to structure web applications in general, and more specifically many potential ways to structure an Angular application.

In practice, most of the time most developers will pick a basic, tried-and-true application structure.