add style to html without angularjs loading them - html

I am using ui-router of angularjs in my SPA. When i add an style to my view pages, angularjs loads them when switching to than view. Thats actually pretty cool that it can be done in runtime.
The problem is i do not want it to do so. for example i want to use bootstrap css in my view. it is already inserted in the main page, so it is not needed to get loaded again form child view. but for my IDE to auto-complete class names, it is needed to be added to html page of subview.
Is there any way to ask Angularjs to ignore Head part and just load Body part of my html?

Related

Is it possible to create an internal html page to my index.html?

I'm creating a new website and I will have different pages on it. However, instead of creating new HTML files for each page and an anchor for each, I want all my pages contained in one HTML file. Is it possible in any way?
You can try Vue js or React js or many js frameworks ... which contain components.
Using HTML
You can control HTML page section how tabs working in HTML, take a look in Bootstrap Tabs, or you can hide/show sections using CSS or using JS, you may store HTML for each page in array of js and load that HTML to Body based on URL you create
Using Server Side Language
Also if you need single page application with multiple pages you need a Server Side language, where Database contains your website configurations and you can load based on the URL each page's layout or text like heading forms etc...

Use nextjs to render a specific part of html page

I'm trying to use nextjs for just a part of my web-site.
The navbar already exists in other frameworks, not even react. i want to use nextjs in a <div id="nextjs_div">...</div>, ie. just a part of my website.
The problem is that nextjs renders a whole HTML page with head and body components. so what I want basically is to delete these components and render just one div that will be mounted in my page.
I tried to modify the page/_document but couldn't succeed.
Do you have an idea of how i can do this.
Next.js is a framework intended to create full pages and most likely not appropriate tool to use for creating a part of a page. You could use just React then.
If you can make an HTML from the navbar then you could insert it into Next.js project.
See Add HTML header to Document.js example

ASP.NET Webforms - Displaying HTML content from a WYSIWYG editor as is without bootstrap styles from Master Page interfering

In ASP.NET Webforms I have a Master Page where bootstrap css is imported. All of the child pages of the site use this Master Page.
One of the child pages displays HTML content originally created in a WYSIWYG editor. Since this child pages uses the master page and relies on it so the header and footer match everything else the styles override the WYSIWYG content styles.
Is there a way I can make it so a section of the page ignores bootstrap even though it is being imported from the master page but the rest of the page like the header and footer still use it?
Trying to avoid separating this page from using the Master Page.
The only possible method I can think of would be to create a custom css file for this page, and create specific css classes for each element that will override the css imported from the bootstrap via masterpage.

how to change the class of the body tag in a jsp base page from a included jsp

I am trying to figure out a solution for our AEM related pages. I need to change the class of the body tag in our base page based on the logic of a jsp included in a page jsps. I need this so I can style universal widget differently to deal with different height fixed headers.
So I can't really provide code examples as we are talking jsps, controllers and editable content widgets content writers can add to the page. So its hard as I am not sure how to proceed with this.
So let me try to explain what we have here. We have a jsp base page which has the html tags set, head tag set all the meta data, css and js libraries we use, and body tag sets. The base page would also contain included jsps that represent the site wide header and footer used across the site. We also would have optional sub navigations that can be added to the page for sub sections of the site and is activated based on the type of page template used. So this means a universal header plus a sub-navigation.
Then each page jsp extends the above described base page. These are the page jsps that act as different page templates for our CMS to use. Content authors can drag content, and html widgets on to the page.
We also have page templates that contain their own third level sub navigations that can be used either with the universal header alone or the universal header and the sub-navigation.
We also have a new scenario where there could be a 4th level navigation that can come in to play. This navigation would be a draggable widget in the cms.
So what I want to do is based on the page template and based on which combination of sub navigations are in play, class the body tag differently based on if the page is the universal header alone, or different classes for any of the sb navigation combinations. this is needed so as content authors drag widgets to the page or develop content I can offset content or change scroll offsets to get around different fixed header/navigation solutions
This sounds like a good case for client-side code. One option is to use JavaScript code that runs on DOM content loaded event ("ready" event if you are using jQuery) to alter the CSS class of the body tag. You could make it so each component has a particular, unique class. Then the JavaScript function could examine the page and find all the unique components and then assign the correct class to the body tag based on what it finds and the logic you write in that JavaScript function.
JSPs will be processed top to bottom on the server, so once the JSP containing the body tag has been processed you won't be able to change what was processed to the response in some subsequent JSP that is processed afterwards.
Also see
https://stackoverflow.com/a/9899701/230055
If I have html elements in JSP then what is order of execution?
You could make a call to a tag for writing out the body HTML tag and in the Java code for that tag you could examine the page node and see what other components have been included and then write out the body tag HTML accordingly if you want to do this on the server. But the key point is that you must do this before the body tag is written. Once the JSP has been processed and the body tag has been written to the response it is too late to change it in a subsequent JSP.
For example, in your JSP you would do something like this:
<myCustomTags:bodyOpeningTagBuilder />
<html>
<head>
</head>
<c:out value="${bodyOpeningTagFromBuilder}" />
...other JSPs
</body>
</html>

Why the html page doesn't load properly?

I'm starting using Angularjs. I have a simple project (HTML + javascript/Angular js). When I visualize the HTML file on my browser I see a second hidden elements. Do you maybe know the reason? How can I solve this?
This problem is caused by the way Angular works. I guess that you are able to see the skeleton of angular (something like {{"your variable"}}) for a second and then the data is rendered to it.
Your angular scripts are called once the page is loaded, so the delay in fetching data from server by your $http.get() methods causes the elements to appear without data.
Thankfully, AngularJS has a simple solution to the problem in the form of ng-cloak directive. Refer the documentation for details.
https://docs.angularjs.org/api/ng/directive/ngCloak