AngularJS 和 Ionic。标题、选项卡 View 中的按钮

标签 angularjs view ionic-framework

我是 Ionic 新手,这是我的第一个项目。我正在创建一个底部带有选项卡导航的小应用程序。

一个选项卡 View 如下所示:

<ion-view title="Account">
  <ion-content class="has-header padding">
    <h1>Account</h1>
  </ion-content>
</ion-view>

我想在“帐户”旁边的标题中添加一个按钮,根据文档,您使用 ion-nav-bar 元素,但当我尝试此操作时,没有显示任何按钮。谁能告诉我如何在选项卡 View 的标题中添加按钮?

最佳答案

您可以像这样使用 ion-nav-button :

<ion-view title="Account">
  <ion-nav-buttons side="left">
      <button class="button" ng-click="doSomething()">
        I'm a button on the left of the navbar!
      </button>
   </ion-nav-buttons>
  <ion-content class="has-header padding">
    <h1>Account</h1>
  </ion-content>
</ion-view>

Example 1 Example 2

关于AngularJS 和 Ionic。标题、选项卡 View 中的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24627304/

相关文章:

typescript - 如何通过 Ionic 4 选项卡按钮传递参数

angular - 使用 Angular 项目从字符串创建动态 CSS 样式

angularjs - 使用 grunt 和 tomcat 的单页应用程序

angularjs - 两条动态子路由 - ui-router

view - hive 侧 View ,带有带有1列作为阵列的 hive 表的示例示例

c++ - Ogre:模拟透视图缩放对象

ionic-framework - 搜索栏 - 在 'enter' 键上搜索

javascript - 使用 ng-options 和 ng-selected 进行 Angular 选择

javascript - 将变量传递给数组列表

ios - 在切换 View 时清除文本字段和 TextView View 的数据