1、v1 与 v2的比较

时间:2023-03-10 01:35:02
1、v1 与 v2的比较

1、路由的迁移

 /* --- v1 ----*/

 .config(function($stateProvider){
$stateProvider
.state('main', {
url: '/',
templateUrl: 'templates/main.html',
controller: 'MainCtrl'
})
}) .controller('MainCtrl', function(){ }) /* --- v1 ----*/
 /* --- v2 ----*/

 @Page({
templateUrl:'main/main.html'
})
export class MainCmp {
constructor(){ }
} /* --- v2 ----*/

2、控制器的迁移

/* --- v1 ----*/

.controller('MainCtrl', function(){
this.data ={
text: 'Hello World'
}
}) /* --- v1 ----*/
/* --- v2 ----*/

export class MainCtrl{
constructor(){
this.data ={
text: 'Hello World'
}
}
} /* --- v2 ----*/