好吧,我已经为这东西挣扎了好几天了,现在我被困住了。这里是我想要的;我想通过单击一个按钮在一个不同的视图中更改我的作用域值。因此,如果我在index.html视图中并单击一个按钮,我希望更改index2.html视图上作用域的值,然后显示该视图。下面是我的代码不起作用的示例
index.html
<div ng-controller="IndexController">
<button class="button button-block button-assertive" ng-click="checkValues()" value="checkitems" >
check values
</button>
</div>IndexController.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:意外令牌:‘’-未定义:未定义“。我也不太明白如何以及为什么要在新视图中使用supersonic.ui.views.params.current来定位新的值。我想在新视图中获得新值,而不是在控制器中?我需要两个不同的控制器吗?我只想在html视图中更新我的值,而不是在其中。
supersonic.ui.layers.push:
( view: view,
options: { params: {$scope.Diagnose : 'test'}
animation: customAnimation
}) => Promise发布于 2015-01-25 22:46:43
根据超音速推送文档,params属性用于在视图之间传递参数:
JSON string of optional parameters to be passed to the target View,
accessible via supersonic.ui.views.params.current.试着打
supersonic.ui.layers.push: (
view: view,
options: {
params: {valueToBeSentAccrossView: <Your Value>}
animation: customAnimation
}) => Promise然后使用supersonic.ui.views.params.current检索目标视图中的值。
https://stackoverflow.com/questions/28141245
复制相似问题