Data Storage Style Binding












0















I have an ionic application with 2 pages. The information from one page (radio buttons) needs to update the text size of another page.
Am i correct in thinking the best way to go about this is to :
store the radio button value in local storage,
call the value in 2nd page from storage, and somehow use this value to update font size?
Any help appreciated.



i have watched tutorials online and this seems to be the only option.



I have the local storage part working correctly (suprisingly) but i am unsure how to update the font of a tag with this value.



Is a switch statement my next step ?










share|improve this question























  • Have you tried NavParams from ionic-angular ?

    – Shank
    Dec 31 '18 at 8:07











  • thanks Tharusha , i will look into it,

    – beginner
    Dec 31 '18 at 12:48













  • Yeah sure! you welcome! @beginner

    – Shank
    Dec 31 '18 at 13:33













  • Tharusha NavParams is an easier way to pass data from one page to another.Im stuck now using this information to update the font size. Im using ngif. The problem is i have two values to update (title and description.) <div *ngIf="title=='a'"> <ion-item text-wrap *ngFor="let movie of warMovies"> <a href="{{movie.url}}"> <ion-thumbnail *ngIf="movie.urlToImage"> <img src="{{movie.urlToImage}}"> </ion-thumbnail> <p style="font-size: 20px;">{{movie.title}}</p> <p>{{movie.description}}</p> </a> </ion-item> </div>

    – beginner
    Jan 1 at 11:57













  • it works but only if i select just one radio button value<div *ngIf="Title=='a'"> <ion-item text-wrap *ngFor="let movie of warMovies"> <p style="font-size: 30px;">{{movie.title}}</p> <p>{{movie.description}}</p> </ion-item> </div> <div *ngIf="description=='g'"> <ion-item text-wrap *ngFor="let movie of warMovies"> <p>{{movie.title}}</p> <h2 style="font-size: 30px;">{{movie.description}}</h2> </ion-item> </div>

    – beginner
    Jan 1 at 12:11


















0















I have an ionic application with 2 pages. The information from one page (radio buttons) needs to update the text size of another page.
Am i correct in thinking the best way to go about this is to :
store the radio button value in local storage,
call the value in 2nd page from storage, and somehow use this value to update font size?
Any help appreciated.



i have watched tutorials online and this seems to be the only option.



I have the local storage part working correctly (suprisingly) but i am unsure how to update the font of a tag with this value.



Is a switch statement my next step ?










share|improve this question























  • Have you tried NavParams from ionic-angular ?

    – Shank
    Dec 31 '18 at 8:07











  • thanks Tharusha , i will look into it,

    – beginner
    Dec 31 '18 at 12:48













  • Yeah sure! you welcome! @beginner

    – Shank
    Dec 31 '18 at 13:33













  • Tharusha NavParams is an easier way to pass data from one page to another.Im stuck now using this information to update the font size. Im using ngif. The problem is i have two values to update (title and description.) <div *ngIf="title=='a'"> <ion-item text-wrap *ngFor="let movie of warMovies"> <a href="{{movie.url}}"> <ion-thumbnail *ngIf="movie.urlToImage"> <img src="{{movie.urlToImage}}"> </ion-thumbnail> <p style="font-size: 20px;">{{movie.title}}</p> <p>{{movie.description}}</p> </a> </ion-item> </div>

    – beginner
    Jan 1 at 11:57













  • it works but only if i select just one radio button value<div *ngIf="Title=='a'"> <ion-item text-wrap *ngFor="let movie of warMovies"> <p style="font-size: 30px;">{{movie.title}}</p> <p>{{movie.description}}</p> </ion-item> </div> <div *ngIf="description=='g'"> <ion-item text-wrap *ngFor="let movie of warMovies"> <p>{{movie.title}}</p> <h2 style="font-size: 30px;">{{movie.description}}</h2> </ion-item> </div>

    – beginner
    Jan 1 at 12:11
















0












0








0








I have an ionic application with 2 pages. The information from one page (radio buttons) needs to update the text size of another page.
Am i correct in thinking the best way to go about this is to :
store the radio button value in local storage,
call the value in 2nd page from storage, and somehow use this value to update font size?
Any help appreciated.



i have watched tutorials online and this seems to be the only option.



I have the local storage part working correctly (suprisingly) but i am unsure how to update the font of a tag with this value.



Is a switch statement my next step ?










share|improve this question














I have an ionic application with 2 pages. The information from one page (radio buttons) needs to update the text size of another page.
Am i correct in thinking the best way to go about this is to :
store the radio button value in local storage,
call the value in 2nd page from storage, and somehow use this value to update font size?
Any help appreciated.



i have watched tutorials online and this seems to be the only option.



I have the local storage part working correctly (suprisingly) but i am unsure how to update the font of a tag with this value.



Is a switch statement my next step ?







ionic-framework






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 30 '18 at 21:13









beginnerbeginner

12




12













  • Have you tried NavParams from ionic-angular ?

    – Shank
    Dec 31 '18 at 8:07











  • thanks Tharusha , i will look into it,

    – beginner
    Dec 31 '18 at 12:48













  • Yeah sure! you welcome! @beginner

    – Shank
    Dec 31 '18 at 13:33













  • Tharusha NavParams is an easier way to pass data from one page to another.Im stuck now using this information to update the font size. Im using ngif. The problem is i have two values to update (title and description.) <div *ngIf="title=='a'"> <ion-item text-wrap *ngFor="let movie of warMovies"> <a href="{{movie.url}}"> <ion-thumbnail *ngIf="movie.urlToImage"> <img src="{{movie.urlToImage}}"> </ion-thumbnail> <p style="font-size: 20px;">{{movie.title}}</p> <p>{{movie.description}}</p> </a> </ion-item> </div>

    – beginner
    Jan 1 at 11:57













  • it works but only if i select just one radio button value<div *ngIf="Title=='a'"> <ion-item text-wrap *ngFor="let movie of warMovies"> <p style="font-size: 30px;">{{movie.title}}</p> <p>{{movie.description}}</p> </ion-item> </div> <div *ngIf="description=='g'"> <ion-item text-wrap *ngFor="let movie of warMovies"> <p>{{movie.title}}</p> <h2 style="font-size: 30px;">{{movie.description}}</h2> </ion-item> </div>

    – beginner
    Jan 1 at 12:11





















  • Have you tried NavParams from ionic-angular ?

    – Shank
    Dec 31 '18 at 8:07











  • thanks Tharusha , i will look into it,

    – beginner
    Dec 31 '18 at 12:48













  • Yeah sure! you welcome! @beginner

    – Shank
    Dec 31 '18 at 13:33













  • Tharusha NavParams is an easier way to pass data from one page to another.Im stuck now using this information to update the font size. Im using ngif. The problem is i have two values to update (title and description.) <div *ngIf="title=='a'"> <ion-item text-wrap *ngFor="let movie of warMovies"> <a href="{{movie.url}}"> <ion-thumbnail *ngIf="movie.urlToImage"> <img src="{{movie.urlToImage}}"> </ion-thumbnail> <p style="font-size: 20px;">{{movie.title}}</p> <p>{{movie.description}}</p> </a> </ion-item> </div>

    – beginner
    Jan 1 at 11:57













  • it works but only if i select just one radio button value<div *ngIf="Title=='a'"> <ion-item text-wrap *ngFor="let movie of warMovies"> <p style="font-size: 30px;">{{movie.title}}</p> <p>{{movie.description}}</p> </ion-item> </div> <div *ngIf="description=='g'"> <ion-item text-wrap *ngFor="let movie of warMovies"> <p>{{movie.title}}</p> <h2 style="font-size: 30px;">{{movie.description}}</h2> </ion-item> </div>

    – beginner
    Jan 1 at 12:11



















Have you tried NavParams from ionic-angular ?

– Shank
Dec 31 '18 at 8:07





Have you tried NavParams from ionic-angular ?

– Shank
Dec 31 '18 at 8:07













thanks Tharusha , i will look into it,

– beginner
Dec 31 '18 at 12:48







thanks Tharusha , i will look into it,

– beginner
Dec 31 '18 at 12:48















Yeah sure! you welcome! @beginner

– Shank
Dec 31 '18 at 13:33







Yeah sure! you welcome! @beginner

– Shank
Dec 31 '18 at 13:33















Tharusha NavParams is an easier way to pass data from one page to another.Im stuck now using this information to update the font size. Im using ngif. The problem is i have two values to update (title and description.) <div *ngIf="title=='a'"> <ion-item text-wrap *ngFor="let movie of warMovies"> <a href="{{movie.url}}"> <ion-thumbnail *ngIf="movie.urlToImage"> <img src="{{movie.urlToImage}}"> </ion-thumbnail> <p style="font-size: 20px;">{{movie.title}}</p> <p>{{movie.description}}</p> </a> </ion-item> </div>

– beginner
Jan 1 at 11:57







Tharusha NavParams is an easier way to pass data from one page to another.Im stuck now using this information to update the font size. Im using ngif. The problem is i have two values to update (title and description.) <div *ngIf="title=='a'"> <ion-item text-wrap *ngFor="let movie of warMovies"> <a href="{{movie.url}}"> <ion-thumbnail *ngIf="movie.urlToImage"> <img src="{{movie.urlToImage}}"> </ion-thumbnail> <p style="font-size: 20px;">{{movie.title}}</p> <p>{{movie.description}}</p> </a> </ion-item> </div>

– beginner
Jan 1 at 11:57















it works but only if i select just one radio button value<div *ngIf="Title=='a'"> <ion-item text-wrap *ngFor="let movie of warMovies"> <p style="font-size: 30px;">{{movie.title}}</p> <p>{{movie.description}}</p> </ion-item> </div> <div *ngIf="description=='g'"> <ion-item text-wrap *ngFor="let movie of warMovies"> <p>{{movie.title}}</p> <h2 style="font-size: 30px;">{{movie.description}}</h2> </ion-item> </div>

– beginner
Jan 1 at 12:11







it works but only if i select just one radio button value<div *ngIf="Title=='a'"> <ion-item text-wrap *ngFor="let movie of warMovies"> <p style="font-size: 30px;">{{movie.title}}</p> <p>{{movie.description}}</p> </ion-item> </div> <div *ngIf="description=='g'"> <ion-item text-wrap *ngFor="let movie of warMovies"> <p>{{movie.title}}</p> <h2 style="font-size: 30px;">{{movie.description}}</h2> </ion-item> </div>

– beginner
Jan 1 at 12:11














1 Answer
1






active

oldest

votes


















0














Pass the values as a Map from home page component



    import { IonicPage, NavController, NavParams} from 'ionic-angular';
import {SecondaryPage} from '../../secondary-page/secondary-page';

@IonicPage()
@Component({
selector: 'page-home',
templateUrl: 'home.html',
})
export class home{

styleSet:Map<string, string> = Map<string, string>();

constructor(public navCtrl: NavController, public navParams: NavParams){}

loadSecondaryPage(){
//Add data to the styleSet and pass from the navCtrl like below;
this.navCtrl.setRoot(SecondaryPage, this.styleSet);
}
}


Get this map from the second page and use it to load your styles



import { IonicPage, NavController, NavParams} from 'ionic-angular';

@IonicPage()
@Component({
selector: 'page-secondary',
templateUrl: 'secondary.html',
})
export class SecondaryPage{

constructor(public navCtrl: NavController, public navParams: NavParams){
  console.log(navParams.get('ItemNameOne')); //get those values by added key name in the map
console.log(navParams.get('ItemNameTwo'));
}
}


You can use any datatype as well to replace the map






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53981479%2fdata-storage-style-binding%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Pass the values as a Map from home page component



        import { IonicPage, NavController, NavParams} from 'ionic-angular';
    import {SecondaryPage} from '../../secondary-page/secondary-page';

    @IonicPage()
    @Component({
    selector: 'page-home',
    templateUrl: 'home.html',
    })
    export class home{

    styleSet:Map<string, string> = Map<string, string>();

    constructor(public navCtrl: NavController, public navParams: NavParams){}

    loadSecondaryPage(){
    //Add data to the styleSet and pass from the navCtrl like below;
    this.navCtrl.setRoot(SecondaryPage, this.styleSet);
    }
    }


    Get this map from the second page and use it to load your styles



    import { IonicPage, NavController, NavParams} from 'ionic-angular';

    @IonicPage()
    @Component({
    selector: 'page-secondary',
    templateUrl: 'secondary.html',
    })
    export class SecondaryPage{

    constructor(public navCtrl: NavController, public navParams: NavParams){
      console.log(navParams.get('ItemNameOne')); //get those values by added key name in the map
    console.log(navParams.get('ItemNameTwo'));
    }
    }


    You can use any datatype as well to replace the map






    share|improve this answer






























      0














      Pass the values as a Map from home page component



          import { IonicPage, NavController, NavParams} from 'ionic-angular';
      import {SecondaryPage} from '../../secondary-page/secondary-page';

      @IonicPage()
      @Component({
      selector: 'page-home',
      templateUrl: 'home.html',
      })
      export class home{

      styleSet:Map<string, string> = Map<string, string>();

      constructor(public navCtrl: NavController, public navParams: NavParams){}

      loadSecondaryPage(){
      //Add data to the styleSet and pass from the navCtrl like below;
      this.navCtrl.setRoot(SecondaryPage, this.styleSet);
      }
      }


      Get this map from the second page and use it to load your styles



      import { IonicPage, NavController, NavParams} from 'ionic-angular';

      @IonicPage()
      @Component({
      selector: 'page-secondary',
      templateUrl: 'secondary.html',
      })
      export class SecondaryPage{

      constructor(public navCtrl: NavController, public navParams: NavParams){
        console.log(navParams.get('ItemNameOne')); //get those values by added key name in the map
      console.log(navParams.get('ItemNameTwo'));
      }
      }


      You can use any datatype as well to replace the map






      share|improve this answer




























        0












        0








        0







        Pass the values as a Map from home page component



            import { IonicPage, NavController, NavParams} from 'ionic-angular';
        import {SecondaryPage} from '../../secondary-page/secondary-page';

        @IonicPage()
        @Component({
        selector: 'page-home',
        templateUrl: 'home.html',
        })
        export class home{

        styleSet:Map<string, string> = Map<string, string>();

        constructor(public navCtrl: NavController, public navParams: NavParams){}

        loadSecondaryPage(){
        //Add data to the styleSet and pass from the navCtrl like below;
        this.navCtrl.setRoot(SecondaryPage, this.styleSet);
        }
        }


        Get this map from the second page and use it to load your styles



        import { IonicPage, NavController, NavParams} from 'ionic-angular';

        @IonicPage()
        @Component({
        selector: 'page-secondary',
        templateUrl: 'secondary.html',
        })
        export class SecondaryPage{

        constructor(public navCtrl: NavController, public navParams: NavParams){
          console.log(navParams.get('ItemNameOne')); //get those values by added key name in the map
        console.log(navParams.get('ItemNameTwo'));
        }
        }


        You can use any datatype as well to replace the map






        share|improve this answer















        Pass the values as a Map from home page component



            import { IonicPage, NavController, NavParams} from 'ionic-angular';
        import {SecondaryPage} from '../../secondary-page/secondary-page';

        @IonicPage()
        @Component({
        selector: 'page-home',
        templateUrl: 'home.html',
        })
        export class home{

        styleSet:Map<string, string> = Map<string, string>();

        constructor(public navCtrl: NavController, public navParams: NavParams){}

        loadSecondaryPage(){
        //Add data to the styleSet and pass from the navCtrl like below;
        this.navCtrl.setRoot(SecondaryPage, this.styleSet);
        }
        }


        Get this map from the second page and use it to load your styles



        import { IonicPage, NavController, NavParams} from 'ionic-angular';

        @IonicPage()
        @Component({
        selector: 'page-secondary',
        templateUrl: 'secondary.html',
        })
        export class SecondaryPage{

        constructor(public navCtrl: NavController, public navParams: NavParams){
          console.log(navParams.get('ItemNameOne')); //get those values by added key name in the map
        console.log(navParams.get('ItemNameTwo'));
        }
        }


        You can use any datatype as well to replace the map







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 2 at 7:08

























        answered Jan 2 at 7:03









        ShankShank

        318719




        318719
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53981479%2fdata-storage-style-binding%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            How to fix TextFormField cause rebuild widget in Flutter

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith