![1、v1 与 v2的比较 1、v1 与 v2的比较](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
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 ----*/