好吧,我已经在这件事上苦苦挣扎了好几天了,我被困住了。这就是我想要的;我想通过单击一个按钮在不同的视图中更改我的范围值。因此,如果我在 index.html 视图中并单击一个按钮,我想更改 index2.html 视图上范围的值,然后显示该视图。这是我的代码不起作用的示例
索引.html
<div ng-controller="IndexController">
<button class="button button-block button-assertive" ng-click="checkValues()" value="checkitems" >
check values
</button>
</div>
索引控制器.js
angular
.module('legeApp')
.controller('IndexController', function($scope, supersonic, $filter) {
$scope.checkValues = function(){
$scope.Diagnose = 'test';
var view = new supersonic.ui.View("legeApp#index2.html");
var customAnimation = supersonic.ui.animate("flipHorizontalFromLeft");
supersonic.ui.layers.push(view, { animation: customAnimation });
};
});
index2.html
<div ng-controller="IndexController">
<div class="card">
<div class="item item-text-wrap">
Test<b>{{Diagnose}} </b>
</div>
</div>
</div>
我可以在 checkValues 方法之外给出值,但我希望它是两个不同的值,具体取决于您单击的按钮。请帮忙
我尝试了建议的代码,但收到错误消息。我究竟做错了什么?
我尝试下面的代码并收到此错误“SyntaxError: Unexpected token ':' - undefined:undefined”。我也不太明白如何以及为什么要在新视图中使用 supersonic.ui.views.params.current 来定位新值。我想在新视图中获取新值,而不是在控制器中?我需要两个不同的控制器吗?我只想在 html 视图中更新我的值,而不是在其中。
supersonic.ui.layers.push:
( view: view,
options: { params: {$scope.Diagnose : 'test'}
animation: customAnimation
}) => Promise