我是离子和角度js的新手,有人可以提供帮助 . 我花了两天时间创建从一个页面到另一个页面的链接但是失败了 .
这是默认标签页上的按钮,如(短划线) . 这是我的控制器:
.controller('DashCtrl', function($scope) {
$scope.create = function () {
alert("new post");
$scope.go('templates/newspost');
};
})
这是我的路线
.state('newspost', {
url: '/newspost',
abstract: true,
templateUrl: 'templates/newspost.html'
})
我不知道我哪里弄错了 .
2 回答
你也可以试试这个:
或者您也可以使用锚标记:
希望它能帮到你!!
我认为你的语法错误 .
你应该写$ state.go('templates / newspost')而不是$ scope.go('templates / newspost')你还应该将$ state添加到.controller这样的函数中
.controller('DashCtrl', function($scope,$state)