openprism.ga

Archive for the ‘Uncategorized’ Category

AngularJS Techniques

Friday, September 15th, 2017

Start Working With AngularJS

AngularJS is a Javascript MVC framework created by Google to build properly architectured and maintenable web applications.

AngularJS takes another approach. It attempts to minimize the impedance mismatch between document centric HTML and what an application needs by creating new HTML constructs. AngularJS teaches the browser new syntax through a construct we call directives. Examples include:

Data binding, as in {{}}.
DOM control structures for repeating, showing and hiding DOM fragments.
Support for forms and form validation.
Attaching new behavior to DOM elements, such as DOM event handling.
Grouping of HTML into reusable components.

Why AngularJS?

AngularJS is a MVC framework that defines numerous concepts to properly organize our web application. Our application is defined with modules that can depend from one to the others. It enhances HTML by attaching directives to your pages with new attributes or tags and expressions in order to define very powerful templates directly in your HTML. It also encapsulates the behavior of your application in controllers which are instanciated thanks to dependency injection. Thanks to the use of dependency injection, AngularJS helps you structure and test your Javascript code very easily. Finally, utility code can easily be factorized into services that can be injected in your controllers. Now let’s have a closer look at all those features.

Feature 1: Two Way Data-Binding

Think of your model as the single-source-of-truth for your application. Your model is where you go to to read or update anything in your application.

Data-binding is probably the coolest and most useful feature in AngularJS. It will save you from writing a considerable amount of boilerplate code. A typical web application may contain up to 80% of its code base, dedicated to traversing, manipulating, and listening to the DOM. Data-binding makes this code disappear, so we can focus on our application.

Think of your model as the single-source-of-truth for your application. Your model is where you go to to read or update anything in your application. The data-binding directives provide a projection of your model to the application view. This projection is seamless, and occurs without any effort from you.

Traditionally, when the model changes, the developer is responsible for manually manipulating the DOM elements and attributes to reflect these changes. This is a two-way street. In one direction, the model changes drive change in DOM elements. In the other, DOM element changes necessitate changes in the model. This is further complicated by user interaction, since the developer is then responsible for interpreting the interactions, merging them into a model, and updating the view. This is a very manual and cumbersome process, which becomes difficult to control, as an application grows in size and complexity.

There must be a better way! AngularJS’ two-way data-binding handles the synchronization between the DOM and the model, and vice versa.

Here is a simple example, which demonstrates how to bind an input value to an

element.

Name:

Enter a name here

Hello, {{yourName}}!

This is extremely simple to set up, and almost magical…

Feature 2: Templates

It’s important to realize that at no point does AngularJS manipulate the template as strings. It’s all the browser DOM.

In AngularJS, a template is just plain-old-HTML. The HTML vocabulary is extended, to contain instructions on how the model should be projected into the view.

The HTML templates are parsed by the browser into the DOM. The DOM then becomes the input to the AngularJS compiler. AngularJS traverses the DOM template for rendering instructions, which are called directives. Collectively, the directives are responsible for setting up the data-binding for your application view.

It is important to realize that at no point does AngularJS manipulate the template as strings. The input to AngularJS is browser DOM and not an HTML string. The data-bindings are DOM transformations, not string concatenations or inner HTML changes. Using the DOM as the input, rather than strings, is the biggest differentiation AngularJS has from its sibling frameworks. Using the DOM is what allows you to extend the directive vocabulary and build your own directives, or even abstract them into reusable components!

One of the greatest advantages to this approach is that it creates a tight workflow between designers and developers. Designers can mark up their HTML as they normally would, and then developers take the baton and hook in functionality, via bindings with very little effort.

Here is an example where I am using the ng-repeat directive to loop over the images array and populate what is essentially an img template.

function AlbumCtrl($scope) {
scope.images = [
{"thumbnail":"img/image_01.png", "description":"Image 01 description"},
{"thumbnail":"img/image_02.png", "description":"Image 02 description"},
{"thumbnail":"img/image_03.png", "description":"Image 03 description"},
{"thumbnail":"img/image_04.png", "description":"Image 04 description"},
{"thumbnail":"img/image_05.png", "description":"Image 05 description"}
];
}

{{image.description}}

It is also worth mentioning, as a side note, that AngularJS does not force you to learn a new syntax or extract your templates from your application.

Feature 3: MVC

AngularJS incorporates the basic principles behind the original MVC software design pattern into how it builds client-side web applications.

The MVC or Model-View-Controller pattern means a lot of different things to different people. AngularJS does not implement MVC in the traditional sense, but rather something closer to MVVM (Model-View-ViewModel).

The Model

The model is simply the data in the application. The model is just plain old JavaScript objects. There is no need to inherit from framework classes, wrap it in proxy objects, or use special getter/setter methods to access it. The fact that we are dealing with vanilla JavaScript is a really nice feature, which cuts down on the application boilerplate.

The ViewModel
A viewmodel is an object that provides specific data and methods to maintain specific views.

The viewmodel is the $scope object that lives within the AngularJS application. $scope is just a simple JavaScript object with a small API designed to detect and broadcast changes to its state.

The Controller
The controller is responsible for setting initial state and augmenting $scope with methods to control behavior. It is worth noting that the controller does not store state and does not interact with remote services.

The View
The view is the HTML that exists after AngularJS has parsed and compiled the HTML to include rendered markup and bindings.

This division creates a solid foundation to architect your application. The $scope has a reference to the data, the controller defines behavior, and the view handles the layout and handing off interaction to the controller to respond accordingly.

Feature 4: Dependency Injection

AngularJS has a built-in dependency injection subsystem that helps the developer by making the application easier to develop, understand, and test.

Dependency Injection (DI) allows you to ask for your dependencies, rather than having to go look for them or make them yourself. Think of it as a way of saying “Hey I need X’, and the DI is responsible for creating and providing it for you.

To gain access to core AngularJS services, it is simply a matter of adding that service as a parameter; AngularJS will detect that you need that service and provide an instance for you.

function EditCtrl($scope, $location, $routeParams) {
// Something clever here…
}
You are also able to define your own custom services and make those available for injection as well.

angular.
module(‘MyServiceModule’, []).
factory(‘notify’, ['$window', function (win) {
return function (msg) {
win.alert(msg);
};
}]);

function myController(scope, notifyService) {
scope.callNotify = function (msg) {
notifyService(msg);
};
}

myController.$inject = ['$scope', 'notify'];

Feature 5: Directives

Directives are my personal favorite feature of AngularJS. Have you ever wished that your browser would do new tricks for you? Well, now it can! This is one of my favorite parts of AngularJS. It is also probably the most challenging aspect of AngularJS.

Directives can be used to create custom HTML tags that serve as new, custom widgets. They can also be used to “decorate” elements with behavior and manipulate DOM attributes in interesting ways.

Here is a simple example of a directive that listens for an event and updates its $scope, accordingly.

myModule.directive(‘myComponent’, function(mySharedService) {
return {
restrict: ‘E’,
controller: function($scope, $attrs, mySharedService) {
$scope.$on(‘handleBroadcast’, function() {
$scope.message = ‘Directive: ‘ + mySharedService.message;
});
},
replace: true,
template: ‘

};
});

Then, you can use this custom directive, like so.

Creating your application as a composition of discrete components makes it incredibly easy to add, update or delete functionality as needed.

we will discuss here about how to set up AngularJS library to be used in web application development. We will also briefly study the directory structure and its contents.

When you open the link https://angularjs.org/, you will see there are two options to download AngularJS library -

AngularJS Download
View on GitHub – Click on this button to go to GitHub and get all of the latest scripts.

Download AngularJS 1 – Or click on this button, a screen as below would be seen -

AngularJS Download
This screen gives various options of using Angular JS as follows -

Downloading and hosting files locally

There are two different options legacy and latest. The names itself are self descriptive. legacy has version less than 1.2.x and latest has 1.5.x version.

We can also go with the minified, uncompressed or zipped version.

CDN access – You also have access to a CDN. The CDN will give you access around the world to regional data centers that in this case, Google host. This means using CDN moves the responsibility of hosting files from your own servers to a series of external ones. This also offers an advantage that if the visitor to your webpage has already downloaded a copy of AngularJS from the same CDN, it won’t have to be re-downloaded.

Try the new angularJS 2 – Click on this button to download Angular JS beta 2 version.This version is very fast, mobile supported and flexible compare to legacy and

latest of AngularJS 1

We are using the CDN versions of the library throughout this tutorial.

Example
Now let us write a simple example using AngularJS library. Let us create an HTML file myfirstexample.HTML as below -

Welcome {{helloTo.title}} to the world of Tutorialspoint!

Following sections describe the above code in detail -

Include AngularJS

We have included the AngularJS JavaScript file in the HTML page so we can use AngularJS -

If you want to update into latest version of Angular JS, use the following script source or else Check the latest version of AngularJS on their official website. Point to AngularJS app Next we tell what part of the HTML contains the AngularJS app. This done by adding the ng-app attribute to the root HTML element of the AngularJS app. You can either add it to HTML element or body element as shown below -

View
The view is this part -

Welcome {{helloTo.title}} to the world of Tutorialspoint!

ng-controller tells AngularJS what controller to use with this view. helloTo.title tells AngularJS to write the “model” value named helloTo.title to the HTML at this
location.

Controller
The controller part is -

This code registers a controller function named HelloController in the angular module named myapp. We will study more about modules and controllers in their respective chapters. The controller function is registered in angular via the angular.module(… ).controller(… ) function call.

The $scope parameter passed to the controller function is the model. The controller function adds a helloTo JavaScript object, and in that object it adds a title field.

Execution
Save the above code as myfirstexample.HTML and open it in any browser. You will see an output as below -

Welcome AngularJS to the world of Tutorialspoint!
When the page is loaded in the browser, following things happen -

HTML document is loaded into the browser, and evaluated by the browser. AngularJS JavaScript file is loaded, the angular global object is created. Next, JavaScript which registers controller functions is executed.

Next AngularJS scans through the HTML to look for AngularJS apps and views. Once view is located, it connects that view to the corresponding controller function.

Next, AngularJS executes the controller functions. It then renders the views with data from the model populated by the controller. The page is now ready.

7 Steps to Automate Your Online Business and Increase Sales

Friday, September 15th, 2017

Today’s entrepreneurs care about being passionate about work and knowing that it has a larger meaning. As entrepreneurs, we like our work to make some impact and help to make the world a better place. At the same time, however, we like our work to be successful. Doing well by doing good. With the worst recession in decades in our rear-view-mirror, today’s entrepreneurs need to be extremely creative and do things efficiently. These 7 steps to automate your online business will increase sales and simplify your operations.

Automation is the key to building a successful business with fewer resources. To create awesome companies, as a team, and to use technology, ultimately to better the world is a common goal of today’s entrepreneur. But at the same time, today’s entrepreneurs don’t have the financial resources available to hire a team of workers. So the more that today’s entrepreneur can accomplish solo, the better.

Finding the formula to entrepreneur success is not going to be an easy journey or a simple task. You need to work at it. However, if you use these 7 steps to online business automation, you can start finding the success and building the future you have always wanted.

7 Steps to Building an Automated Online Business:

Here are seven steps that you can take on your journey to becoming a self-employed, free and highly successful entrepreneur without breaking the bank.

1. Build a WordPress Website

The most popular content management system available today is WordPress. As today’s entrepreneur, you will want to select the right content management system to build your website. WordPress fits the bill. It’s free, its secure, its customizable so you can implement these automation tips into your website and get close to reaching your goal of building an automated online business.

Choose a professional WordPress theme that is clean, fast, and responsive. We recommend StudioPress WordPress Themes. They are powered by the Genesis Framework, which in layman’s terms, means that the behind-the-scenes nuts and bolts of your website will be search engine friendly, responsive with instant updates and airtight security. Don’t waste time with the wrong WordPress theme. Choose a framework that is state-of-the-art and one that will update with the click of a mouse. Many sites are hacked (or just don’t use WordPress to the fullest) because they have not been updated and with StudioPress themes, the act of updating your code to the most recent technology takes just a click. Updating to the current version of WordPress and Genesis a snap. Everything is integrated, so you don’t have to call your developer. Save time and money.

First Impressions Count: Your website is only as good as your design and your web hosting company.

2. Build your Email List

Email marketing is a powerful tool that can extend your reach beyond your website and create new sales opportunities. If you’re not building an email list, you’re making a huge mistake, so get started right off the bat with your new business and begin building an email list.

Any networking event provides excellent opportunities to collect business cards, which can then be manually added to your email list. But if your like most entrepreneurs, there is not enough time in the day to attend every Chamber of Commerce event. So, in order to build your email list, you need to automate. The easiest and most effective way to automate your email marketing efforts is with Aweber Email Marketing. I have tried them all and I always come back to Aweber.

First, you need to determine who is your target audience. This simple exercise will help. First, answer these questions:

  1. What do your ideal subscribers want?
  2. What’s the main problem they have that you believe you can solve?
  3. What’s your method for solving that problem?
  4. What do you love to talk about more than anything?

Once you’re done, you simply combine them all. These are the people you are catering to. This is your target audience.

3. Write Compelling Content

The most effective way to grow visitors to your website or blog is to write compelling content. Yes, that’s right. The time you spent in English class in high school will finally come in handy. When you’re writing content, you will want to think about the audience you’re trying to reach… and call them out. Write evergreen content that helps, informs and satisfies your target audience.

  • Evergreen content is timeless content that is still relevant. You could go through your archives, or you could also use a WordPress plug-in like Revive Old Posts to simplify the process. There is also a killer tool that I use called MeetEdgar that allows you to publish a post and then automatically recycle your top posts several times on a schedule.

The number of subscribers you have is directly related to…

  1. Your ability to drive highly-targeted traffic to your blog.
  2. Your ability to convert that traffic into FIERCELY LOYAL subscribers.
  3. Your ability to get your readers to promote and refer you to friends.

Now it’s up to you you to take action and build your email list with compelling content.

4. Build your Social Media Profiles

When it comes to online personal or business branding, the creation of social media profiles is absolutely essential. Think of each social media profile you create as a landing page for your brand. This landing page is possibly the first encounter that someone is going to have with your brand, and you will want that first impression to be golden and make the visitor want to know more about you.

10 steps you need to follow to create a successful social media profile:

  1. Your name – Be sure to enter the name you want to be found under.
  2. Your username – Think about what people will search for you, and make sure that your username is included in the URL.
  3. Your profile pic – Use a professional photograph, but not so much that you don’t illustrate some personality. Be sure to stick with the same picture as your default photo from one network to the next. This way people easily recognize you across all social networks.
  4. Your link – Make sure that your link is front and center so that people can find it quickly and click through to your website.
  5. Your bio – Take advantage of this to share only the best about yourself and your brand. And always – always – link to your website or landing page.
  6. Your interests – Look at these fields as an additional place to get some great keyword value. Find books, documentaries, and profiles of influential people in your industry and add those in these additional fields.
  7. Your background – A customized background will allow you to share additional information that may not fit in the fields of your profile.
  8. Your privacy settings – These vary from network to network, but you will want to make sure that the information you would like to be public is viewable.
  9. Your activity – Once your profile setup is complete, your on-going mission will be to maintain a healthy level of activity on your main social networks, which for most will be Twitter, Facebook, and LinkedIn. Automate this! We like Buffer. It’s inexpensive and a great way to keep your social media activity at peak performance.
  10. Your promotion – your website!

If you are short on time, concentrate on the Social Media Big Three:

  • Facebook
  • Twitter
  • LinkedIn.

Don’t forget to interlink your profiles to each other. If you can share multiple links on a social profile, make sure some of those are to your main social profiles.

5. Sync your Blog or Website

Add social share buttons onto your page or automatically post on social media whenever you publish a new article. Additionally, with Step 2 (above) you will have the ability to create a blog broadcast with Aweber so that each time you publish a new blog post to your WordPress website, Aweber will use your post to create dynamic newsletter and broadcast your content to everyone on your email list.

Why? Because research shows that the lead nurturing process today takes seven to eight “touches”. These seven to eight touches that it takes to qualify a lead are crucial components of the lead nurturing process, allowing marketing the opportunity to educate and inform prospects as they move through each stage in the buying journey. These touch points are opportunities to prepare leads for the final stage in the buying journey, the point of decision-making.

  • Sync your social media profiles to landing pages that are specific to your visitor. Our favorite automation tool for conversion optimization is Thrive Leads Landing Pages. Build an automated sales funnel that runs a highly optimized.
  • Sync your website with an opt-in form so that your visitors can easily subscribe to your newsletter:
    • Aweber has many templates that you can use to add an opt-in form to your website.
    • ThriveLeads has many different “triggers”. Trigger options can be the following:
      • Show on page load
      • Show after a certain period of time
      • Show when the user scrolls to a specific part of the content
      • Show when the user scrolls to a percentage of the way down the content
      • Show when the user is about to exit the page (exit intent) – this trigger option does not work on mobile devices.
      • Show when the form enters viewport
      • Show when the user clicks an element
      • Displays on click.

Customize which opt-in form displays, when and where with ThriveLeads. You can organize all the forms you want to display automatically on the site into different Lead Groups. Within each Lead Group, you can create and edit multiple opt-in forms at once, set them to appear in multiple places, and set up A/B tests.

We “connect” our ThriveLeads form to Aweber’s API so that when a visitor completes the opt-in form, their email address is automatically added to our master email list at Aweber. And from within Aweber, we have a blog broadcast setup so that when a new blog post is published, a nifty newsletter is automatically created using their templates and sent to addresses in our list.

And finally, we use Aweber’s form templates to display a static and well-designed, professional opt-in form in the sidebar of our blog. Again, when a visitor completes the form, their email address is automatically added the master email list managed with Aweber.

6. Analyze your Competitors

Get insights into your competitors’ strategies in display advertising, organic and paid search, and link building. SEMRush Online Marketing Tools automate your research and optimization efforts. SEMrush will make your job a lot easier by taking the guesswork out of researching the market and your competition. It takes the guess work out of your digital marketing time and helps you to know before-hand what works, and what is a waste of time.

7. Fill your Orders

If you are selling products online, you will soon discover that filling orders is time consuming. Automate your order fulfillment with Order Fulfillment by Amazon. With FBA, you store your products in Amazon’s fulfillment centers, and Amazon will pick, pack, ship, and provide customer service for them. It’s a tremendous time saver for you as you grow your online store.Keep these steps in mind if you are looking to gain the freedom that most entrepreneurs want. These steps may just be your path towards a more successful online business.The better the experience and the more valuable each of these important steps are, the more ready your leads will be to make a buying decision, and the more likely they are to convert to paying customers. The result is a highly organized, efficient buying journey that runs like a well-oiled machine. And one item that cannot be automated is you! Your leads and customers will want to have interaction, of some type, with you – the company owner. Be professional and always follow telephone and social media etiquette when communicating with the public. Remember, you are building your brand. And your brand is an asset.