src/app/app.component.ts
Component principal del proyecto
selector | blog-root |
styleUrls | ./app.component.css |
templateUrl | ./app.component.html |
Properties |
Methods |
constructor()
|
Defined in src/app/app.component.ts:20
|
Para formar los elementos e inicializar |
init |
init()
|
Defined in src/app/app.component.ts:66
|
Iniciar
Returns :
void
|
title |
title:
|
Type : string
|
Default value : 'blog-angular'
|
Defined in src/app/app.component.ts:20
|
Titulo |
import { Component } from '@angular/core';
/**
* Declaramos las variables para jQuery
*/
declare var $: any;
/**
* Component principal del proyecto
*/
@Component({
selector: 'blog-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
/**
* Titulo
*/
title = 'blog-angular';
/**
* Para formar los elementos e inicializar
*/
constructor() {
// Floating label headings for the contact form
$('body').on('input propertychange', '.floating-label-form-group', function(e) {
$(this).toggleClass('floating-label-form-group-with-value', !!$(e.target).val());
}).on('focus', '.floating-label-form-group', function() {
$(this).addClass('floating-label-form-group-with-focus');
}).on('blur', '.floating-label-form-group', function() {
$(this).removeClass('floating-label-form-group-with-focus');
});
// Show the navbar when the page is scrolled up
const MQL = 992;
// primary navigation slide-in effect
if ($(window).width() > MQL) {
const headerHeight = $('#mainNav').height();
$(window).on('scroll', {
previousTop: 0
},
function() {
const currentTop = $(window).scrollTop();
// check if user is scrolling up
if (currentTop < this.previousTop) {
// if scrolling up...
if (currentTop > 0 && $('#mainNav').hasClass('is-fixed')) {
$('#mainNav').addClass('is-visible');
} else {
$('#mainNav').removeClass('is-visible is-fixed');
}
} else if (currentTop > this.previousTop) {
// if scrolling down...
$('#mainNav').removeClass('is-visible');
if (currentTop > headerHeight && !$('#mainNav').hasClass('is-fixed')) { $('#mainNav').addClass('is-fixed'); }
}
this.previousTop = currentTop;
});
}
}
/**
* Iniciar
*/
init() {
}
}
<!--The content below is only a placeholder and can be replaced.-->
<blog-navbar></blog-navbar>
<blog-header></blog-header>
<!--<div style="text-align:center">
<h1>
Welcome to {{ title }}!
</h1>
<img width="300" alt="Angular Logo" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==">
</div>
<h2>Here are some links to help you start: </h2>
<ul>
<li>
<h2><a target="_blank" rel="noopener" href="https://angular.io/tutorial">Tour of Heroes</a></h2>
</li>
<li>
<h2><a target="_blank" rel="noopener" href="https://angular.io/cli">CLI Documentation</a></h2>
</li>
<li>
<h2><a target="_blank" rel="noopener" href="https://blog.angular.io/">Angular blog</a></h2>
</li>
</ul>-->
<!-- Main Content -->
<div class="container">
<router-outlet></router-outlet>
</div>
<hr>
<blog-footer></blog-footer>
./app.component.css