首页 > ionic 不同页面间怎么进行函数操作哦

ionic 不同页面间怎么进行函数操作哦

请问 如下图我在添加标签页面上输入的数据,然后点击保存,怎么将输入的数据增加在能力特长页面上哦,我写了个增加方法,但我发现只能同一页面上的点击事件才能调用,像这种跨页面的就不能调用了。该怎么操作了,谢谢各位了。

这是我的增加方法 写在一个控制器里面的。

app.controller('labelList', function ($scope) {
  $scope.labelList = [{name: "后台管理",percent: "100%"},{name: "java",percent: "80%"},{name: "网页前端",percent: "70%"}];

  $scope.addLabel = function () {
    var newLabel = {name: " ", percent: " "};
    $scope.labelList.push(newLabel);
  }

  $scope.delLabel = function (v) {
    $scope.labelList.splice(v,1);
  }
})

可以用路由的嵌套,

把共用的方法绑定在父路由的$scope上,这样数据也能共享

【热门文章】
【热门文章】