在近几年比较火的框架中有vue.js和angular.js,其中vue.js和angular.js的数据展示大致相同,在此放在一起比较,方便大家记忆
1.angular展示一条基本数据:
var app=angular.module('app',[]);
app.controller('xxx',function($scope){ //C
$scope.msg='welcome'
})
html:
div ng-controller="xxx"
{{msg}}
2.vue展示一条基本数据:
html:
<div id="box">
{{msg}}
</div>
var c=new Vue({
el:'#box', //选择器
data:{
msg:'welcome vue'
}
});