Giter Site home page Giter Site logo

trazek / ionic-modal-nav-example Goto Github PK

View Code? Open in Web Editor NEW
10.0 10.0 0.0 5.89 MB

A starting project showing how the ionic-modal-nav can be used in Ionic applications

Home Page: https://www.npmjs.com/package/ionic-modal-nav

JavaScript 80.37% CSS 19.53% HTML 0.10%

ionic-modal-nav-example's People

Contributors

trazek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ionic-modal-nav-example's Issues

Failed to instantiate module IonicModalNav

Can't seem to get IonicModalNav to work properly. Code is below:

angular.module('blah.controllers', ['ionic','blah.services','ngCordova','blah.utils', 'IonicModalNav'])

.controller('MainCtrl', ['$scope', '$location','$stateParams', '$ionicModal', 'IonicModalNavService') {
$scope.openPreferenceSelector = function(type) {
       IonicModalNavService.go('blahselector');
}

Any idea why? "ionic-modal-nav": "^1.0.4" is included in my package.json and it's installed.

I'm using ionic 1.3.1 if that makes a difference.

Repo for ionic-modal-nav?

Hello,

I could not find the repository for the ionic-modal-nav component?
I would like to use this component in my project but with bower, but since you did not publish it on bower I could always add it from git if I could find your repository?

It would also be easier to propose enhancements via PR if it had its own separate repository.

Unable to access data passed through .go

I'm passing the data using:

IonicModalNavService.go('blah', { id: blah });

When the control for that modal initializes this line will run:

console.log($stateParams.id);

This returns an empty string, rather than undefined. What's being passed into id is a valid integer, rather than an empty string. Any idea what I'm doing wrong here?

Updating data from a modal to another not working

Hi there, first thank you for your plugin, it's pretty awesome.

I'm having an issue when I navigate through modal view and populating array. The two modal states are sharing the same controller. In one hand, I'm populating a scope variable array from modal A and in another hand, display this array inside the modal B.

But the array on modal B stays empty.

Questions :

  • Can we share controllers (so scope variables) between different state modals ?
  • If yes, how to do it properly ?

EDIT : Just realised that the controller (and also the initialization of my variable) is called on $state.go due. Preferable to split controller and share the data with a directive.

Thank you

IonicModalNavService does not pass data to modal

Hi and sorry to my english.
I want to pass data to modal with $stateParams, but IonicModalNavService does not passed.
Here is my code:

// 1. register a route to $stateProvider
$stateProvider.state('comment-list', {
  views: {
    'ionic-modal-nav@': {
      templateUrl: 'views/board/article-comment.html',
      controller: 'MyController as myCtrl'
    }
  },
  param: {
    url: null,
    articleID: null
  }
});

// 2. show and pass data by IonicModalNavService 
IonicModalNavService.show('comment-list', {
    url: vm.store.url,
    articleID: vm.article.id,
  });

// 3. check passed data at MyController, but it is empty.
function MyController($scope, $stateParams) {
  console.log($stateParams.url);  // undefined
  console.log($stateParams.articleID);  // undefined
  ...
}

so i change few code:

  key: "show",
  value: function show(modalState, data) {
    ...

    // fire event with passed data
    this._$rootScope.$emit(SHOW_MODAL, data);

    ...
function IonicModalNavService($ionicModal, $rootScope, $state, $ionicHistory, $ionicViewSwitcher, modalOptions) {
  ...

  $rootScope.$on(SHOW_MODAL, function (event, data) {
    // set passed data to modal object
    _this._modal.params = data;
    _this._modal.show();
  });

  ...
}

so i got passed data at MyController:

function MyController($scope, $stateParams) {

  $scope.$on('modal.shown', function (e, data) {
    console.log(data.params.url);  // http://abc.com
    console.log(data.params.articleID);  // 100
  });

  ...
}

Please check this issue. Thanks.

Allow backdropClickToClose

The default ionic modal opens with:

  $ionicModal.fromTemplateUrl("templates/modal.html", {
      scope: $scope,
      backdropClickToClose: false, // Default true
      animation: 'slide-in-up'
  })
  .then(function(modal){
      $scope.modal = modal;
      $scope.modal.show();
  })

backdropClickToClose can be passed in to allow/disallow closing the modal by clicking the backdrop. Is this currently possible? I gave the following a shot:

IonicModalNavService.show('app.initiallaunch_personalinfo', {backdropClickToClose: true});

It didn't work, as I guessed, since that object is meant to be data, rather than options. I think this would be helpful to pass in on initial instantiation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.