Generating documentation in an ASP.NET Core MVC app. The view renders headings with ids and the contents of other sections needs to link to them.
Example view:
#foreach (MyObject thing in Model)
{
<h5 id="#thing.Name">#thing.Name</h5>
<h6>List</h6>
#foreach (MySubObject otherThing in thing.SubObjects)
{
<div class="row">
<div class="col-md-4 col-sm-6">#otherThing.Name</div>
<div class="col-md-4 col-sm-6">
#if (otherThing.HasParent)
{
<a href="#($"#{otherThing.ParentName}")">
#otherThing.ParentName
</a>
}
</div>
</div>
}
}
This generates exactly what I want it to:
<div class="row">
<div class="col-md-4 col-sm-6">OtherThing7Name</div>
<div class="col-md-4 col-sm-6">
<a href="#ParentName">
ParentName
</a>
</div>
</div>
...
<h5 id="ParentName">ParentName</h5>
But the link, when I hover over it, goes to http://localhost/#ParentName instead of preserving the route data e.g. http://localhost/Documentation/Things#ParentName, so instead of just jumping to that location on the page, it takes it to the root of the application.
Update:
Okay, it looks like this is happening because <base href="~/" /> is defined in the View Layout being used (which all Views in the application use). Removing it allowed the link to work as expected, but I don't know what effects it would have on the rest of the site.
Related
Trying to add the 4 dry out logo to this html template. Can anyone correct what I did wrong? It shows this on the site:
This is a very small section of the code where I have the image placed in the body.
<body>
<!-- Loader -->
<div id="loader-wrapper">
<div id="loader"></div>
<div class="loader-section section-left"></div>
<div class="loader-section section-right"></div>
</div>
<!-- Page Content -->
<div class="container-fluid tm-main">
<div class="row tm-main-row">
<!-- Sidebar -->
<div id="tmSideBar" class="col-xl-3 col-lg-4 col-md-12 col-sm-12 sidebar">
<button id="tmMainNavToggle" class="menu-icon">☰</button>
<div class="inner">
<nav id="tmMainNav" class="tm-main-nav">
<ul>
<!--ERROR IMG --> <img data-image="4 Dry Out Logo.jpg" alt="4 Dry Out Logo">
<li>
Unless there is other code acting on your img tag, you need to use the src attribute to specify an image URL. Spaces in the image name could also be causing an issue.
You'll want to open up your web browser's developer tools and see if you can see where the image is requested in the network tab. If the URL is returning a 404 error, you know that there is an issue with your image's path. If the request for the image isn't being made at all, then there is an issue with your img tag or the code that is supposed to cause the request for the image to be sent.
<img data-image="4DryOutLogo.jpg" alt="4 Dry Out Logo">
First you need to consider renaming the image and remove white space from the name.
Second , you have to use the code as below
<img src = "../yourimagename.jpg">
Finally ,
You have to make sure that your image exist with in the server path.
I suggest you to first open the image via url link , once its open copy paste that url into the src code .
Good luck
I want to use NG-ZORRO pagination in the Html page, it's working but fine but how do I link content with the pagination?
This is my Html code
<div class="row card-group-row">
<div class="col-md-6 col-lg-4 col-xl-3" *ngFor="let course of draftCourses"> //I want to paginate this data
<div class="card-blog">
<a href="#">
<img src="../assets/images/image.jpg" alt="" class="img-blog" />
</a>
<div class="card-blog-wrap">
<a href="#">
<h4 class="title-blog">{{course.course_title}}</h4>
</a>
</div>
</div>
</div>
<nz-pagination [nzPageIndex]="1" [nzTotal]="500" [nzPageSize]="2" id="demo"> </nz-pagination>
</div>
I am getting pagination in HTML but it's not linked with the content. I have used ngx-pagination before but I want to use nz-pagination in my code, so can someone help me how to do it.
This is the official link for NG-ZORRO Click here for link
Thanks in advance.
You need to implement event which will trigger on page index change.
For binding use (nzPageIndexChange):
<nz-pagination [nzPageIndex]="1" [nzTotal]="500" [nzPageSize]="2" (nzPageIndexChange)="onPageIndexChange($event)" id="demo"></nz-pagination>
Then in your component you can implement like below:
export class YourAngularComponent{
onPageIndexChange($event) {
//do something here to go to next page
}
.
.
}
Forgive the stupid question -- i know i'm doing something retarded, but I'm kinda stuck.
I'm a complete newbie -- and I inherited this website that is build on spring, thymeleaf, hibernate, java and a bunch of other technologies that i'm still learning. The original developer will not take my calls.
All the development is being done on Eclipse -- and I can get the existing project to run and build on my laptop.
I'm trying create a new page and link to it from my main default page (index.htlm).
I can create the href tag to an "existing" html file in the root folder.
But when I reference a new html page in the same directory -- the reference goes to 404.
What am I doing wrong.
Here is the original html snip:
<!-- Contractors -->
<div class="col-md-3 col-md-offset-1 col-sm-10 col-sm-offset-1 box-shadow 10px 10px " style="padding: 50px">
<span class="h1 type--bold">Contractors & Handymen</span><span class="h2">Looking for side hustle?</span>
<p class="lead">Be alerted to in-network jobs.</p>
<div class="row">
<div class="col-sm-12 col-xs-12">
<a th:href="#{/company}" href="company.html"
class="btn btn--sm btn--warning"><span
class="btn__text type--uppercase">Register Here</span></a>
</div>
</div>
</div>
I created a page in the same directory as "company.html" the file name is "signUpContractor.html"
And I updated the html snip as such:
<!-- Contractors -->
<div class="col-md-3 col-md-offset-1 col-sm-10 col-sm-offset-1 box-shadow 10px 10px " style="padding: 50px">
<span class="h1 type--bold">Contractors & Handymen</span><span class="h2">Looking for side hustle?</span>
<p class="lead">Be alerted to in-network jobs.</p>
<div class="row">
<div class="col-sm-12 col-xs-12">
<a th:href="#{/signUpContractor}" href="signUpContractor.html"
class="btn btn--sm btn--warning"><span
class="btn__text type--uppercase">Register Here</span></a>
</div>
</div>
</div>
output looks like this:
enter image description here
but when i click the link get this:
enter image description here
do i need to register the page with thymeleaf? or something?
if i reference other pages in the folder (that was existing prior to me taking over) such as "about.html" or "contactUs.html" the href works just fine. But any new page I create will go to 404.
Thanks for the kind soul that can help me navigate this.
Apologize in advance for the newbie question, i'm just out on the deep-end right now.
:-)
I'm new to Angular, Bootstrap and front-end programming.
I'd like to create several boxes.
After clicking on the box, detailed view of it should display above all boxes section.
This is what I'm trying to create:
and then after clicking on box number 1:
But now it looks like this:
I'm creating these boxes via Angular *ngFor loop like this:
<div class="container text-center" id="cryptocontainer">
<div class="row" *ngIf="coins">
<div *ngFor="let coin of objectKeys(coins); let i = index" id="currencybox" class="col-md-2" (click)="coinDetails(coin,i)">
<img id="image" [src]="getImage(coin)" class="img-responsive">
<div class="cryptoname">{{ coin }}</div>
<div class="cryptoprice">{{ coins[coin].USD | currency:'USD':true}}</div>
<div class="details" *ngIf="detailToggle[i]" no-lines>
<div class="row">
<div class="col">
<div class="label">CHANGE(30 dni)</div>
<canvas id="canvas{{i}}">{{ chart[i] }}</canvas>
</div>
</div>
<div class="row" id="details">
<div class="col-sm">
<div class="label">MARKET CAP</div>
<div class="answer">{{details.MKTCAP}}</div>
</div>
<div class="col-sm">
<div class="label">CHANGE(24h)</div>
<div class="answer">{{ details.CHANGE24HOUR }} ({{ details.CHANGEPCT24HOUR }}%)</div>
</div>
<div class="col-sm">
<div class="label">MAX (24h)</div>
<div class="answer">{{ details.HIGH24HOUR }}</div>
</div>
</div>
</div>
</div>
</div>
</div>
It's difficult to answer specifically without seeing your component code, but what you are probably missing, conceptually, is an understanding of how to break a UI like this into components and then pass data between those components in the "Angular" way. There are several ways to attack this. Ideally, I think you would move the details div to a separate component that has an input that receives the details, then create a separate component for the clickable divs that have an output that fires a custom event when clicked. These would both be instantiated in the template of a parent component, which would hold the current state of the clicked detail.
So, when you click a clickable component, it passes its details data back up to the parent, where it's set on the details property. Since the input on the display/canvas component is bound to that property, angular change detection will handle updating that component for you.
Here is a stackblitz with a simplified example of the communication pattern I am describing. You could also do something like create a shared service that you inject into both and then update that when a component is clicked.
https://angular-azmcxt.stackblitz.io
Stackblitz Editor Link
I am trying to display the data as follows (doesn't work):
{{#each request}}
<div class="col-sm-4 col-lg-4 col-md-4">
<div class="thumbnail" style="padding:0;border:0px;height:300px;overflow-y:auto">
<img src="{{URLs[0]}}" alt="">
<div class="container">
<h4>{{title}}
<h4 style="color:red;">{{status}}</h4>
</h4>
</div>
</div>
</div>
{{/each}}
and I get the following error printed in the console:
Exception from Tracker recompute function: debug.js:41 Error: Can't
call non-function:
https://firebasestorage.googleapis.com/v0/b/omantourplacesapp.appspot.com/o/TourPlacesImages%2FIMG_0005.JPG?alt=media&token=22ab7965-3b03-4e7f-9798-99617b82dd9b
When I replace the following line:
<img src="{{URLs[0]}}" alt="">
With:
<img src="https://upload.wikimedia.org/wikipedia/commons/0/0f/2010-02-19_3000x2000_chicago_skyline.jpg" alt="">
It works and I can see the image showing in the browser.
Why Firebase images are not working?
NOTE: I am building native IOS application and I could retrieve the same image using the same Firebase URL there.
Don't use brackets use {{URLs.0}}