Category Archives: Javascript

Vuejs: conditional rendering

[Fuente: https://vuejs.org/v2/guide/conditional.html] Conditional Rendering v-if The directive v-if is used to conditionally render a block. The block will only be rendered if the directive’s expression returns a truthy value. <h1 v-if=”awesome”>Vue is awesome!</h1> It is also possible to add an “else block” with v-else: <h1 v-if=”awesome”>Vue is awesome!</h1> <h1 v-else>Oh no 😢</h1> Conditional Groups with v-if on <template> Because v-if is a directive, […]

Vuejs: class and style bindings

[Fuente: https://vuejs.org/v2/guide/class-and-style.html] Class and Style Bindings A common need for data binding is manipulating an element’s class list and its inline styles. Since they are both attributes, we can use v-bind to handle them: we only need to calculate a final string with our expressions. However, meddling with string concatenation is annoying and error-prone. For this reason, […]

Vuejs: computed properties and watches

[Fuente: https://vuejs.org/v2/guide/computed.html] Computed Properties and Watchers Computed Properties In-template expressions are very convenient, but they are meant for simple operations. Putting too much logic in your templates can make them bloated and hard to maintain. For example: <div id=”example”> {{ message.split(”).reverse().join(”) }} </div> At this point, the template is no longer simple and declarative. You […]

Vuejs Template syntax

[Fuente: https://vuejs.org/v2/guide/syntax.html] Template Syntax Vue.js uses an HTML-based template syntax that allows you to declaratively bind the rendered DOM to the underlying Vue instance’s data. All Vue.js templates are valid HTML that can be parsed by spec-compliant browsers and HTML parsers. Under the hood, Vue compiles the templates into Virtual DOM render functions. Combined with […]

Vuejs The instance

[Fuente: https://vuejs.org/v2/guide/instance.html] The Vue Instance Creating a Vue Instance Every Vue application starts by creating a new Vue instance with the Vue function: var vm = new Vue({ // options }) Although not strictly associated with the MVVM pattern, Vue’s design was partly inspired by it. As a convention, we often use the variable vm (short for ViewModel) to refer to our […]

Vuejs Introduction 1

[Fuente https://vuejs.org/v2/guide/] What is Vue.js? Vue (pronounced /vjuː/, like view) is a progressive framework for building user interfaces. Unlike other monolithic frameworks, Vue is designed from the ground up to be incrementally adoptable. The core library is focused on the view layer only, and is easy to pick up and integrate with other libraries or existing projects. On […]

Qunit: intro to unit testing

[Fuente: https://qunitjs.com/intro/] You probably know that testing is good, but the first hurdle to overcome when trying to write unit tests for client-side code is the lack of any actual units; JavaScript code is written for each page of a website or each module of an application and is closely intermixed with back-end logic and […]

AngularJS + JEST

[Fuente: https://medium.zenika.com/testing-an-angularjs-app-with-jest-3029a613251] I will not try to write the ultimate guide to test an AngularJS app with Jest, this article is only my feedback after trying Jest on my project. TL;DR It works pretty well 🙂 First, let me add some context. I was a huge AngularJS fan and slowly drifted to React. That’s probably why I […]

Angular Observables

[fuente: https://angular.io/guide/observables] Observables Observables provide support for passing messages between publishers and subscribers in your application. Observables offer significant benefits over other techniques for event handling, asynchronous programming, and handling multiple values. Observables are declarative—that is, you define a function for publishing values, but it is not executed until a consumer subscribes to it. The […]

Create a responsive Angular D3 charts

[fuente: https://school.geekwall.in/p/SJ52XGRWX/create-a-responsive-angular-d3-charts] While the landscape of frameworks available for structuring and building web applications is changing by the minute, D3 is still the recognized way to create visualizations using Javascript. In this tutorial, we will add a D3 chart to an Angular application and make the size of the graph dynamic. Note: You can find […]