首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AngularJs+ionic将数据从html发送到Controller / popupbox

问AngularJs+ionic将数据从html发送到Controller / popupbox
EN

Stack Overflow用户
提问于 2015-01-22 07:49:31
回答 1查看 573关注 0票数 0

我也想在弹出框中显示内容。这些信息已经提供给html了。使用ng-repeat="x in titles"

问题,那么我如何传递内容,我的controller.js,以便它可以显示在弹出框中?注意:我太传递x.excerpt太ng-click="showAlert()"了,所以它可以显示在弹出框中。

代码语言:javascript
复制
<ul>
  <li ng-repeat="x in titles">
  <br />
 <hr />
   <h3> {{ x.title  }} </h3>
    <p>{{x.date | date : format : 'MM-dd-yyyy'}}</p>
        <img src="{{x.featured_image.attachment_meta.sizes.medium.url}}" width="100%" >
    <span >
        <p>{{x.excerpt}}</p>

                <button class="button button-small button-assertive" ng-click="showAlert()">
                    Click here too display Content
                </button>
    </span>
  </li>
</ul>

Controller.js

代码语言:javascript
复制
 // An alert dialog
 $scope.showAlert = function() {
   var alertPopup = $ionicPopup.alert({
     title: 'Don\'t eat that!',
     template: 'This is where I want the content too be.'
   });
   alertPopup.then(function(res) {
     console.log('Thank you for not eating my delicious ice cream cone');
   });
 };
EN

回答 1

Stack Overflow用户

发布于 2015-01-22 08:40:10

双向数据绑定

谢谢,用以下方式解决了这个问题:

试一试

代码语言:javascript
复制
 <input type='text' ng-model="profileedit_name">
 <button ng-click="doSaveProfileEdit(profileedit_name)" >Save</button>

使用

代码语言:javascript
复制
$scope.doSaveProfileEdit = function(newName) {
  alert(newName);
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28083620

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档