Skip to content

'undefined' on scope variabels #229

Open

Description

@germg

Hi, im using your wizard and it loses value of variables. Justs take 'undefined' value always. If initialize the scope variables with a default value, i'll get it but isn't dynamic. Have any suggestion? Regards.

Activity

  1. ibnYusrat commented on Feb 23, 2017

    @ibnYusrat

    Please share your code.

  2. fcarreno commented on Dec 5, 2017

    @fcarreno

    I seem to have the same issue. Here's an example:

    • Template...

    <wizard on-finish="ok()" hide-indicators="true"> <wz-step wz-title="job"> <h4>Prompt...</h4> <input type="radio" data-ng-model="hired" data-ng-value="true">Si</input> <input type="radio" data-ng-model="hired" data-ng-value="false">No</input> </wz-step> </wizard>

    • Controlller....

    $scope.ok = function(){
    console.log($scope.hired); // ---> shows undefined.
    // Same as @germg - if I initialize $scope.hired in the controller, change is not pushed from the
    // template, when selecting one of the options on the radio buttons.
    }

    Seems like a scope issue, could this related to the directive using an isolated scope without inheriting the parent one? Not sure at this point how to make this work...I've read some references to the context object in some existing issues filed, but can't get a hold of it either.

    I'm using angular 1.4.14 and the wizard directive is included in a template used by the angular bootstrap uib modal service (angular bootstrap version = 2.5.0), if that helps...

  3. fcarreno commented on Dec 5, 2017

    @fcarreno

    I found out that declaring the model as an object, and then using it on the templates works.
    Replace data-ng-model="hired" by data-ng-model="wizard.model" in view.

    And then in controller, declare/initialize a $scope.wizard = {}

    Maybe it's a workaround, but if not - and it's the way we're supposed to get the values set from the template, in the controller - then seems a basic item to include in the documentation...Sorry if I missed it!

    The demo does not seem to include inputs on the different steps, just navigation...maybe worth to include it there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions