javascript - Angular.js doesn't work -
javascript - Angular.js doesn't work -
i'm trying larn angular.js, wrote simple code test it:
<!doctype html> <html ng-app="myapp"> <head> <meta charset="utf-8"> <title>angular.js</title> <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" /> </head> <body> <script type="text/javascript" src="js/angular.min.js"></script> <script type="text/javascript" src="js/myapp.js"></script> <p>the sum of 5+10 is: {{5 + 10}}</p> </body> </html>
in browser i'm supposed see next output: the sum of 5+10 is: 15
, see is: the sum of 5+10 is: {{5 + 10}}
. tried both in chrome , ff, tried add together angular.js google cdn <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
, tried move script between <head>
tags, outcome same.
what doing wrong? why don't have output correctly?
either remove name initialization in html:
<html ng-app>
or initialize module in javascript file:
var myapp = angular.module("myapp", []);
second way better.
javascript angularjs
Comments
Post a Comment