javascript - Place of ng-app in html tags -
this question has answer here:
i'm new angularjs. lecturer said ng-app can use in html, body, div tags etc. question is, if ng-app can use in html tag , body tag, there use if use in html tag rather body tag? mean is, head tag middle of body , html. there effect cause in head tags when use html tag or not. hope question clear.
the reason place ng-app inside html tag on body tag because want manipulate inside of head , body using angularjs. here example:
<html ng-app="myapp"> <head> <meta charset="utf-8"> <title ng-bind="'title - ' + title"></title> <link rel="stylesheet" href="/css/style.css" /> </head> <body> ... notice in title have ng-bind, way can use variable name title change title of web page user on. title title - what ever link on in app.js make title var global variable. 1 reason put ng-app in html tag instead of body.
Comments
Post a Comment