I'm trying to display my fetched remote data, from IonicPage to template view using ng-repeat.
How to display my fetched remote data into ionic html view?
Running Ionic-4.
I’ve tried to log fetched remote data, web call is ok. It seems template-view load before fetched-remote-data.
1 - Following method load data
public onLoadData(){
this.http.get(this.cfg.fetchPlatformUrl()).subscribe((data: any) => {
this.remoteData = data;
});
}
2 - Following method get data from IonicPage variable
public getRemoteExerciseData(){
return this.exerciseVideos;
}
3 - its template view code does not listing as i expected.
<ion-list>
<ion-list-header>
<ion-label>
<b>Exercise List</b></i>
</ion-label>
</ion-list-header>
<!-- START - ISSUE IDENTIFIER -->
<ion-item ng-repeat="ex in getRemoteExerciseData()">
Video 1
<ion-chip color="success">
<ion-label>V</ion-label>
<ion-icon name="happy" color="success"></ion-icon>
</ion-chip>
<ion-chip color="danger">
<ion-label>X</ion-label>
<ion-icon name="sad" color="danger"></ion-icon>
</ion-chip>
</ion-item>
<!-- END - ISSUE IDENTIFIER -->
</ion-list>
I expect see the list of fetched remote data, but the actual template view show only one.
Exercise List
<!-- START - ISSUE IDENTIFIER -->
<ion-item *ngFor="ex in getRemoteExerciseData()">
Video 1
<ion-chip color="success">
<ion-label>V</ion-label>
<ion-icon name="happy" color="success"></ion-icon>
</ion-chip>
<ion-chip color="danger">
<ion-label>X</ion-label>
<ion-icon name="sad" color="danger"></ion-icon>
</ion-chip>
</ion-item>
<!-- END - ISSUE IDENTIFIER -->
For latests Angular versions, you should use ngFor
Related
I'm trying to set a background image in my template email, but without attachement.
I've tried to upload the image in the server, it works fine but to view the email it needs to click for downloading it.
I've tried this :
<div style="background-image: url({{asset('logo.jpg')}})">
and this :
<div style="background-image: url('{{ email.image('#img/logo.jpg') }}')">
Thanks.
I think the problem is that you need an absolute URL (starting with http://your.domain.com/etc) for the image to work inside the email:
<div style="background-image: url({{ absolute_url(asset('logo.jpg')) }})">
This ionic page is just a form with some elements. In the Phone field, I have created a modal that opens when you click on an image:
<ion-grid>
<ion-row>
<ion-col>
<form #registerForm="ngForm" novalidate [formGroup]="form">
[...]
<ion-item>
<img item-left margin-left src={{flagPath}} (click)="presentCountryModal()">
<p item-left (click)="presentCountryModal()">+{{countryCode}}</p>
<ion-icon item-left name="arrow-dropdown" (click)="presentCountryModal()">
</ion-icon>
<ion-input
placeholder="Phone"
type="text"
[(ngModel)]="account.phone"
name="phone"
required
pattern=".{8,}"
#phone="ngModel"
></ion-input>
</ion-item>
It works perfectly on iOS and Windows on ionic-lab. But in Android the behavior is different: when I click on the image, the Phone ion-input gets the focus and the whole form moves up, making space for the keyboard and hiding the field under the header.
I'd like to:
1) Be able to make the image clickable.
2) Disable the automatic scrolling when an ion-input gets focused. I've tried keyboard.disableScroll(true) with no success.
Any ideas? Thanks!
UPDATE:
As explained here, adding .input-cover { position: static; } to the scss files stabilizes the form and makes the image click event responsive! So that solves the first question.
But I still have the problem that, when the keyboard opens, the whole page moves up and the top elements hide below the header (and you can't scroll them down).
1) You need to make a separated ion-item form the img. If you have an ion-input inside an ion-item, everything you put together will be "part" of that input.
2) The easiest way to do this without manipulating via ts is using a regular input, not the ion-input or using the ion-input inside a div instead of the ion-item. The second one i'm just guesing, since the behaviour of the scroll for showing the keyboard happens if you have an ion-input inside ion-item.
Hope this helps :)
I am trying to display images from my ionic app in in a similar fashion to the below:-
<ion-header>
<ion-navbar>
<ion-title>Blah/ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<div id="image">
</div>
</ion-content>
and in my typescript file, I write the following:-
LoadImage(hash, id){
document.getElementById("image").innerHTML = '<img src="'+ img_URL + '" />';
}
However, using this method ends up with the image link being broken, and in debugging with js, a 403 error pops up. what is the correct method to display an image from an external source?
Thanks in advance.
Let's try a more angular way of approaching this instead of the document.getElementById
<ion-content padding>
<div [innerHtml]="myImage">
</div>
</ion-content>
And then
public myImage: string;
// assume the parameters are neccessary in real code but not for MCVE
loadImage() {
this.myImage = '<img src="'+ img_url + '"/>';
}
Pluker: http://plnkr.co/edit/WBeRRJyYucLwvckjh5W7?p=preview
So, sadly, after taking a look at one of your images, the response was
"The owner of this site does not allow hotlinking"
Which means that this image cannot be embedded.
This is happening because of the automatic sanitization of the URLs by angular.
you can read about it here : https://angular.io/api/platform-browser/DomSanitizer
this is already answered in
Angular 2 disable sanitize
I'm having an issue with a rendering I'm building in Sitecore 8 Update 3, using MVC with Glass Mapper v4.
I have a Feature Promo rendering that has a Rendering Parameter Template Feature Promo Parameters which defines a droplist field named Align with the possible values Left and Right.
When in Experience Editor and Preview mode the rendering renders correctly and when debugging RenderingContext.Current["Parameters"] contains Align=Left or Align=Right accordingly, and Glass maps this correctly to my POCO.
However, when in web mode, the first rendering has Align=Left as its parameter, all subsequent renderings of the same type have Align with no value.
Checking the layout XML in the web database via Sitecore Rocks, I can see the parameters are there correctly:
<r p:p="1" xmlns:p="p" xmlns:s="s">
<d id="{FE5D7FDF-89C0-4D99-9AA3-B5FBD009C9F3}">
<r p:before="r[#uid='{CAE5DB0F-1971-4931-939B-9F7DB14AF0F8}']"
s:ds="{F63266A5-CC62-4915-9D89-CB01C7A0D05A}"
s:id="{6BA52384-D976-499D-8A0D-7F729EB4376B}"
s:par="Align=Left" s:ph="main"
uid="{4CBD0824-D232-46F9-8763-295D3B493A4F}"/>
<r p:before="r[#uid='{12A7C72A-1821-4F8D-9A87-745604BE5106}']"
s:ds="{C50C7579-3680-46C3-93B2-9429EB9E0100}"
s:id="{6BA52384-D976-499D-8A0D-7F729EB4376B}"
s:par="Align=Right" s:ph="main"
uid="{CAE5DB0F-1971-4931-939B-9F7DB14AF0F8}"/>
<r p:before="*[1=2]" uid="{12A7C72A-1821-4F8D-9A87-745604BE5106}"/>
</d>
</r>
No matter what I do, the second (and any subsequent renderings of the same type) doesn't get the specified parameter value.
The code of the rendering is as follows:
#model Promo
#{
var settings = Html.Glass().GetRenderingParameters<FeaturePromoParameters>();
var alignment = "feature-promo-style-a";
if (settings != null && settings.Align.EqualsText("Right")) {
alignment = "feature-promo-style-b";
}
}
<div class="feature-promo #alignment">
<div class="layout layout-a">
<div class="region region-a">
<div class="region-inner">
<div class="feature-promo-image-container">
#Html.Glass().Editable(m => m.Image)
</div>
<div class="block block-size-b feature-promo-text">
#if (Html.Glass().IsInEditingMode || !Model.PreTitle.IsEmptyOrNull()) {
<div class="pre-title">#Html.Glass().Editable(m => m.PreTitle)</div>
}
#if (Html.Glass().IsInEditingMode || !Model.Title.IsEmptyOrNull()) {
<h2 class="h3 color-a">#Html.Glass().Editable(m => m.Title)</h2>
}
#Html.Glass().Editable(m => m.Body)
</div>
</div>
</div>
</div>
</div>
Can anyone advise what I'm doing wrong, or if I've found a random bug?
Update for Marek Musielak:
OK, its now only hitting the breakpoint once -- and has the uid of the first rendering on the page: {4CBD0824-D232-46F9-8763-295D3B493A4F}. Could this turn out to be something dynamic placeholders related?
RenderingContext.CurrentOrNull.Rendering["Parameters"] = "Align=Left"
This appears to be due to caching... oh the shame.
The renderings had Cacheable unchecked, and no other caching settings selected.
I've just updated them to have Cacheable checked and Vary by Parameters checked, re-published and its now working correctly.
I would have thought that having Cacheable off would mean the rendering would not be cached, but apparently not.
Thanks.
I am having issue with loading Facebook Profile Images in my application. I get list of my friends fromt the graph API and then display the relevant Friend Info and their public profile images
My HTML is as below.
<div id = "profile_picture" style="float:left; width:100px;height: 100px" >
<img src="https://graph.facebook.com/{{providerUserId}}/picture?width=100&height=100"/>
</div>
<div id="user_basic_info" style="float:left;margin-left:14px;">
<div id="name" style="font-size:16px;font-weight:bold;margin-bottom:6px;">{{name}}</div>
<div id="email" style="margin-bottom:6px;width:400px;">{{email}}</div>
<div id="address"></div>
</div>
The {{}} are Mustache templates which get populated via the model.
For some reason the images don't load up in Chrome; but work fine in Chrome Canary, Firefox, Safari.
It doesn't make a difference if I pass in hardcoded userId also.
Any guidance??
Check to see if you have any chrome plugins causing the issue by opening the url in incognito mode, that is assuming you have all the extensions disabled in that mode.
I noticed that the disconnect extension hid the images as you described.