angular2怎么初始化数据

angular2怎么初始化数据


炎炎设计
浏览 1155回答 2
2回答

人到中年有点甜

123456789101112131415161718<html><head><title>AngularJs&nbsp;Demo</title><script&nbsp;type='text/javascript'&nbsp;src="./angular.min.js"></script></head><body&nbsp;ng-app="myApp"><h1>AngularJs&nbsp;Demo</h1><div&nbsp;ng-cloak&nbsp;ng-controller="DemoCtrl"&nbsp;ng-init="pageInit()">{{hello}}</div><script&nbsp;type='text/javascript'>var&nbsp;app&nbsp;=&nbsp;angular.module('myApp',&nbsp;[]);app.controller('DemoCtrl',&nbsp;function($scope)&nbsp;{&nbsp;&nbsp;$scope.pageInit&nbsp;=&nbsp;function()&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;$scope.hello&nbsp;=&nbsp;'Hello&nbsp;AngularJs';&nbsp;&nbsp;}});</script></body></html>保存为html,&nbsp;当前目录需要angular.min.js文件.&nbsp;
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

AngularJS