Development on Various Platforms
11.7K views | +6 today
Follow
Development on Various Platforms
Your new post is loading...
Your new post is loading...
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Building scalable applications with Angular.js

AngularJS today is one of the most powerful, user-friendly and popular JS frameworks to work on web applications. Surprisingly, one of the main weaknesses of this framework is poorly structured documentation and the lack of ready-made solutions. In this report, we will try to work out the best approach to the organization of large and very large applications. We will also speak about the tools that will be useful at every stage of the application development and tools and practicesthat will help you to work in the continuous delivery mode.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

AngularJS: Factory vs Service vs Provider

AngularJS: Factory vs Service vs Provider | Development on Various Platforms | Scoop.it

When you first get started with Angular, you’ll naturally find yourself flooding your controllers and scopes with unnecessary logic. It’s important to realize early on that your controller should be very thin; meaning, most of the business logic and persistent data in your application should be taken care of or stored in a service. I see a few questions a day on Stack Overflow regarding someone trying to have persistent data in his or her controller. That’s just not the purpose of a controller. For memory purposes, controllers are instantiated only when they are needed and discarded when they are not. Because of this, every time you switch a route or reload a page, Angular cleans up the current controller. Services however provide a means for keeping data around for the lifetime of an application while they also can be used across different controllers in a consistent manner.

Angular provides us with three ways to create and register our own service.

1) Factory
2) Service
3) Provider


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

ngprogress-lite - Angular provider for slim progress bars

ngprogress-lite - Angular provider for slim progress bars | Development on Various Platforms | Scoop.it

Nice looking slim progress bars provider for Angular.js applications.

It has similar API as original popular jQuery plugin (see references) to keep things as simple as possible.

The only dependency is angular.js framework.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

AngularJs Good Unit Test Structure For Controllers & How to test ajax code and Promises

AngularJs Good Unit Test Structure For Controllers & How to test ajax code and Promises | Development on Various Platforms | Scoop.it

The poorly the structure is made for unit testing the more and more complected it will take to write a unit test for a simple functioning piece of code , and it will feel that your fighting your way against testing, instead it should feel more fun! So i’ll be showing a structure that worked for me very well when working with angular controllers Before going deep with the structure, i’ll be using

* Jasmine (unit testing)

* Jasmine spies (mocking)

* karma (because its awesome)


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Share state between controllers in AngularJS

You start punching out mad code. You set up services, filters, directives and a whole bunch of controllers. It’s all gorgeous. AngularJS makes you write good code. Everything sort of naturally falls into place and even as the code base grows, it never gets unweildy. When you, in brief moments of insanity, try to work against the framework, it prompty punishes you. Not because it is cruel, but to protect you from making architectural mistakes. Monstrosities in unmaintainability. You chant the mantra: “testability, dependency injection, modularity”, and figure it out. You didn’t need to create a class in order to contain that piece of conversion logic, you needed a filter. Everything is right again.

Eventually you end up at the point where one controller needs to talk to another controller. And AngularJS fails you. Now really, this isn’t a failure on AngularJS’s part at all, but rather just a result of keeping all dependencies handled by a DI framework. Your controller has some state, and another controller also wants the same state. This could be a username, a config object, just about anything. Of course, now you see it.You need a service.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

AngularJS Directive Design Made Easy

AngularJS Directive Design Made Easy | Development on Various Platforms | Scoop.it

Directives make our lives easier when you can reuse them without needing to read or edit the source code. Then we can forget how they work, and just remember what they do.

If you’re coming from a view-centric framework, like Backbone, you may be tempted to separate your application into view-like directive chunks. For example, if you want to display a list of users, you might create a directive that reads $scope.users and prints them all out:

<user-list/>

The user-list directive works. I mean, look how DRY it is! However, contrast it withng-repeat, which handles only the repetition. Which one could be used in more places? What if you need to display users differently in two places?


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Drag and Drop File Upload with AngularJS

Drag and Drop File Upload with AngularJS | Development on Various Platforms | Scoop.it

A reusable AngularJS directive leveraging HTML5 Drag and Drop and the FileReader API.

Directives allow you to create new HTML elements, attributes, classes, or comments that can transform the behavior of the DOM. A better way of thinking about directives is “a way to teach HTML new tricks.” In this example, you will see how to leverage directives to solve a common drag and drop problem that can be reused in the future.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Variable templates for an AngularJS directive

Variable templates for an AngularJS directive | Development on Various Platforms | Scoop.it

Sometimes web services and APIs return different data sets for the same type of object. For example, the tumblr API will return a list of posts, but each post type has different data associated with it: text posts have a title and body, while photo posts have captions and images.

Since having different components and directives for each post type doesn't make much sense (especially when they're all displayed in one stream, as on tumblr), it's beneficial to be able to conditionally load a template based on the post type of each individual post.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Semantic-UI & AngularJS - Basic Registration Form with Validation

Semantic-UI & AngularJS - Basic Registration Form with Validation | Development on Various Platforms | Scoop.it

The idea is that Semantic is a more fluent and structured way to writing a web application, rather than naming stuff poorly like Bootstrap does with things like col-lg-4, Semantic opts for column. This is both good and bad. The examples on their homepage are more semantic, but at the cost of either writing less or more code in order to describe the UI elements in the markup.

You end up writing lots but instead of shifting around in CSS to figure out how to move it from left to right, I just described it. Sure enough, button sat on the right hand side!

Things used in this demo1. Semantic UI2. AngularJS3. NancyFX

Nothing is complete without Nancy, but I'm not showing any Nancy stuff. I'm including it in-case I show the server side stuff.

 


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Preventing Navigation in an AngularJS Project

New technologies bring new solutions to problems. Sometimes, however, they also bring old problems back. One of these old problems for AngularJS is interrupting navigation in a web application.

It used to be that you could hook into the approriate window event (onbeforeonload) and be done with it. Unfortunately, AngularJS introduces the idea of a single-page app in which you never donavigate away from that page (and thus the window.onbeforeonload event will never fire). Complicating the matter is the fact that when you’re developing within an angular application that you’re relying on the angular framework to provide you with a solution.

What’s a poor developer to do?


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

AngularJS, Phonegap, and angular-seed. Let's Go!

AngularJS, Phonegap, and angular-seed. Let's Go! | Development on Various Platforms | Scoop.it
A guide through how I was able to use the angular-seed and phonegap projects to start myself on the path to my first mobile application.

In my exploratory phase with angular, I had discovered the angular-seed project and angular-phonecat tutorial. I knew angular-seed would start me out with runnable jasmine unit tests, an end-to-end suite, a web-server, and some other niceties. That’s when I got the bright idea that I should just make angular-seed run as a phonegap app! 8 hours later…

If you follow this guide I think you can have angular-seed running in the XCode simulator in less than 30 minutes. Exciting right? I know.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Web Development Trends: Mobile First, Data-Oriented Development, and Single Page Applications

Web Development Trends: Mobile First, Data-Oriented Development, and Single Page Applications | Development on Various Platforms | Scoop.it

There are a million things that could be covered for this type of talk (HTML5 anyone?) but I only had 60 minutes and couldn’t possibly cover them all so I decided to focus on 3 key areas: mobile, data-oriented development, and SPAs. The talk was geared toward introducing people (many who weren’t Web developers) to topics such as mobile first development (demos showed a few tools to help here), responsive design techniques, data binding techniques that can simplify code, and Single Page Application (SPA) benefits. Links to code demos shown during the presentation can be found at the end of the slide deck.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

AngularJs native tag editor

AngularJs native tag editor | Development on Various Platforms | Scoop.it

Continuing my series on directives that fill gaps in the angular framework, today I will discuss my implementation of a tag editor. In some ways this is simpler than my previous attempts, no new services needed to be created, however, there are a lot of styling concerns that need to be dealt with. I think I found a reasonable approach that provides adecent default look and feel and provides implementers the flexibility to provide their own styling.

Design Goals

* Native

* Control styling

* Enable tag interactivity

* Support edit & read-only modes


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

AngularJS Tutorials

AngularJS Tutorials | Development on Various Platforms | Scoop.it

Tutorial 11: AngularJS Navigation
Tutorial 10: Angularjs routeParams Example
Tutorial 9: How to config angularjs routing?
Tutorial 8: Binding input field to filters
Tutorial 7: Using filters in AngularJS service
Tutorial 6: Using AngularJS service
Tutorial 5: AngularJS Complex Models
Tutorial 4: Modules in AngularJS
Tutorial 3: What is MVC Architecture in AngularJS ?
Tutorial 2: Basic App in AngularJS
Tutorial 1: AngularJS Tutorial


Via Jan Hesse
more...
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Atmosphere and AngularJS

Atmosphere and AngularJS | Development on Various Platforms | Scoop.it

Atmosphere framework is the The Asynchronous WebSocket/Comet Framework for building asynchronous web applications.

You code your asynchronous web application using one codebase and deploy it on any Servlet container or straight to the cloud. There's no need to think about WebSocket support or hardcode specific vendor implementations.

Sounds too good to be true, doesn't it? Let me show you that it is true, indeed.

The tutorial is based on the excellent example from the Atmosphere examples project and modified to use AngularJS for the front end.

Let's analyze requirement more thoroughly.

* There must be a front-end allowing user to submit the name.

* There must be a way to connect and listen for the incoming messages asynchronously from the front end.

* The server must asynchronously process incoming chat messages and notify all users in the chat.

As it will become clear after completion of this tutorial, Atmospheres framework makes it incredibly easy to deal with the server side asynchronous processing. You'll find that most of time you are spending building nice front-ends instead of dealing with complexities of asynchronous request processing.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Parse x Angular JS Boilerplate by BRANDiD

Parse x Angular JS Boilerplate by BRANDiD | Development on Various Platforms | Scoop.it

At BRANDiD, we’re totally in love with Parse, which is saving us months and months of backend programming the more we use it. We also really love AngularJS for all its insane two-way data binding, its declarative semantics, and commitment to modularity. All of this means you can build apps FAST. And that’s exactly what Parse wants to help you do too. In fact, we think AngularJS and Parse are a match made in heaven. To prove it, today, we’re releasing the Parse x AngularJS Boilerplate, so you don’t need dragon-ninja skills in asynchronous programming to build complex apps with Parse and AngularJS!

Features include:
* AngularJS wrapper for the Parse JS SDK
* AngularJS wrapper for Cloud Code
* AngularJS wrapper for the Facebook API
* Enhanced Parse.Object and Parse.Collection
* State Manager using ui-router
* Resolve Parse Data Before State Changes
* Easy Animations on State Change
* Enhanced loading of the Parse and Facebook SDKs
* Data Modules for Parse Models and Collections
* …and more

 


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

AngularJS on top of ASP.NET: Moving the MVC framework out to the browser

AngularJS on top of ASP.NET: Moving the MVC framework out to the browser | Development on Various Platforms | Scoop.it

Heavily drawing inspiration from Ruby on Rails, MVC4’s convention over configuration model of development soon became the Holy Grail of .NET web development. The MVC model brought with it the goodness of proper separation of concerns between business logic, data, and the presentation logic.

However, the MVC paradigm, was still one in which server side .NET code could be mixed with presentation code. The Razor templating engine, though cleaner than its predecessors, still encouraged and allowed you to mix .NET server side code with presentation logic.

Mixing .NET code with HTML in views can soon get very messy. Wouldn’t it be nice if the presentation layer (HTML) could be pure HTML? Also, in the ASP.NET MVC model, some of the business logic invariably resides in the controller. It is tempting to use an anti­pattern like the one shown above to control whether a div should be shown or not.

However, best practice would indicate that the Controller should not be aware of the div. The ShowDiv variable in the model should not exist. A controller should ideally, only be used to do the plumbing of getting the data populated in the model and nothing else. The view (ideally pure HTML) should render the presentation layer based on the model.

In this article we will see how Angular JS, a new JavaScript framework by Google can be used effectively to build web applications where:

1. Views are pure HTML

2. Controllers (in the server sense) are pure REST based API calls

3. The presentation layer is loaded as needed from partial HTML only files.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Unit Testing Best Practices in AngularJS

Unit Testing Best Practices in AngularJS | Development on Various Platforms | Scoop.it

What should I be testing and when should I be writing tests?

I think it's essential that you learn to love the feeling of having a water-tight app. One which you know is not going to, you know, suddenly die the moment someone else starts making changes.

It might just be me, but when you've written a nice function, and you've verified it works the way it should, it feels solid. You see green ticks on a command line, all tests passed. BOOM! You've just written some of the most solid, reliable code that's ever been written!

Level 1. Unit TestingLevel 2. Integration Testing

Level 3. Mocking


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Breaking the Ice with AngularUI Utils

Breaking the Ice with AngularUI Utils | Development on Various Platforms | Scoop.it

The UI Utils library is a powerful utility package that makes a lot of custom extensions available to your project without needing to reinvent the wheel.
We’ll cover a few notable features that the ui-utils library gives us, including:
* input masking
* custom event handling
* custom formatting
* jQuery passthrough directives
* string inflector
* fragment inclusion based on selectors
* text highlighting
* more…


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

How to Create a Configurable AngularJS Directive

How to Create a Configurable AngularJS Directive | Development on Various Platforms | Scoop.it
Creating a directive with AngularJS is easy. Check out how I made one to handle errors effortlessly.

In our CampNG class, we have a section on adding validations and error messages. Having to add a span for each possible validation error is pretty tedious, so I thought I’d have a go at writing a directive to do it. One thing that was interesting about building it was making it configurable. I haven’t seen much info out there about how to do this, so I thought I’d talk about how I did it.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Responsive website using AngularJS

Responsive website using AngularJS | Development on Various Platforms | Scoop.it

In today’s tutorial, I’m going to show you the process of creating almost an entire website with a new library – AngularJS. However, firstly, I would like to introduce to you the AngularJS.

Using this framework allows us to clearly distinguish between templates (DOM), models and functionality (in controllers). Let’s come back to our template, take a look at our result...


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Decorating your tests in AngularJS

Decorating your tests in AngularJS | Development on Various Platforms | Scoop.it

We’ve been using AngularJS at MuleSoft for building our upcoming web-based developer tools and so far we have really enjoyed using it. One area that’s really important to us as developers is unit testing our JavaScript code.This ensures we deliver high quality code that is easy to maintain and refactor and allows us to ship features quickly with confidence Decorators in Angular are really useful for unit testing your Angular JavaScript code. This post is an example of how you can use them to to use them to create great unit tests.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

AngularJS native drag and drop

AngularJS native drag and drop | Development on Various Platforms | Scoop.it

I recently needed to add drag & drop functionality to an angularjs web application I’m working on, none of the existing directives did exactly what I needed so I built my own. In building the directive, I needed a service to create UUIDs, so I built one of them too.

Design Goals
* Provide a mechanism to respond to a user dragging one element onto another
* No dependency on external frameworks
* No html template
* Applied via attribute
* Use native HTML5 drag & drop api


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

AngularJS CRUD Grid v5: Now with Dynamic Columns

AngularJS CRUD Grid v5: Now with Dynamic Columns | Development on Various Platforms | Scoop.it

Here’s how I built a quick single entity CRUD grid with AngularJS, WebAPI, Entity Framework, Bootstrap, Font Awesome & Toastr.  I spent a more time than I should have getting this all wired up, so I thought I’d share the code to save you some time. 


Via Jan Hesse
more...
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Form Autocomplete and Remember Password with AngularJS

Form Autocomplete and Remember Password with AngularJS | Development on Various Platforms | Scoop.it

Recently a user complained about the log in form not saving the credentials. This is a common problem with AJAX and single-page applications. But I decided to get to the bottom with it.

The UserApp “dashboard” is built with the JavaScript framework AngularJS, and it doesn’t play along very well with the “save password” feature. These are the issues I addressed:

* The form cannot be dynamically inserted into the DOM.

* The form must perform an actual POST request.

* When the browser autofills the fields, the scope doesn’t get updated.

Firefox was easy, all it required was that the form had a name attribute.


Via Jan Hesse
more...
No comment yet.