Data Storage Style Binding
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
|
show 1 more comment
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
Have you triedNavParams
fromionic-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
|
show 1 more comment
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
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
ionic-framework
asked Dec 30 '18 at 21:13


beginnerbeginner
12
12
Have you triedNavParams
fromionic-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
|
show 1 more comment
Have you triedNavParams
fromionic-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
|
show 1 more comment
1 Answer
1
active
oldest
votes
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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
add a comment |
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
add a comment |
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
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
edited Jan 2 at 7:08
answered Jan 2 at 7:03


ShankShank
318719
318719
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Have you tried
NavParams
fromionic-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