Getting started with Angularjs and webapi

  • _service = service;
    }

    // GET: api/Product
    public IEnumerableProduct Get()
    {

    var products = _service.GetAllProducts();
    return products;
    }

     

    ShoppingService

    public class ShoppingService: IShoppingService
    {
    private readonly IRepositoryCategory _categoryRepository;
    private readonly IRepositoryProduct _productRepository;
    private readonly IRepositoryImage _imageRepository;
    public categoryRepository,
    IRepositoryProduct productRepository, IRepositoryImage imageRepository)
    {
    this.

  • _imageRepository = imageRepository;

    }

    public ListProduct GetAllProducts()
    {
    return _productRepository.GetAll();
    }

    public ListCategory GetAllCategories()
    {
    return _categoryRepository.GetAll();
    }

    ProductRepository

    public class ProductRepository : IRepositoryProduct
    {
    private readonly DataContext _dbContext;

    public ProductRepository(DataContext dbContext)
    {
    _dbContext = dbContext;
    }
    public ListProduct GetAll()
    {
    return _dbContext.Products.ToList();
    }

     

    Since we use sqlcompact file to store our data, we need to install sql compact package from nuget, point the sql connection to add name=”DefaultConnection” connectionString=”Data Source =|DataDirectory|Tourism.sdf” /

    Then install sql compact package from nuget, point the sql connection to add name=”DefaultConnection” connectionString=”Data Source =|DataDirectory|Tourism.sdf” /

    Now we just finished writing web api to retrieve data from sql compact file.

  • If the web api is working as expected, I now start creating the single page app, install angularjs App = angular.module(‘App’, [‘ngRoute’]);

    // configure our routes
    App.config(function ($routeProvider) {
    $routeProvider

    // route for the home page
    .

  • index.html

    body ng-app=”App”
    div class=”navbar navbar-inverse navbar-fixed-top”
    div class=”container”
    div class=”navbar-header”
    button type=”button” class=”navbar-toggle” data-toggle=”collapse” span class=”icon-bar”/span
    span class=”icon-bar”/span
    span class=”icon-bar”/span
    /button
    a href=”#/” title=”SPA – TechFunda” class=”navbar-brand”SPA/a
    /div
    div class=”navbar-collapse collapse”
    ul class=”nav navbar-nav”
    li class=”active”a href=”#/”Home/a/li
    lia href=”#/PD”Personal Details/a/li
    lia href=”#/about”About us/a/li
    lia href=”#/contact”Contact us/a/li
    /ul
    /div
    /div
    /div
    div class=”container body-content”

    div id=”divLoading” ng-show=”loading” style=”font-size:50px;”
    div class=”loading”
    Loading …..
    /div
    /div
    div ng-view/div
    hr /

    /div
    /body

    The ng-app value needs to be same as the what is defined in the js.

  • Url}}” style=”height:250px;” alt=””

    div class=”caption price-color”
    h4 h4
    {{item.Name}}
    /h4
    /div
    div class=”caption description-color”
    p{{item.Description}}/p
    /div
    div class=”caption description-color”

    /div
    /div
    /a
    /div
    /div

    Each child view has its own controller, and it is responsible for retrieving and rendering the data in the view.

; Author: honzha99; Updated: 19 Feb 2017; Section: ASP.NET; Chapter: Web Development; Updated: 19 Feb 2017
Continue reading “Getting started with Angularjs and webapi”

angular-scalable-boilerplate

  • This allows for ease of file management and separation of content and functionality between sections.
  • Everyone has their own preferences for file structure and site organization.
  • When you add a new section, you just add a line pointing to its “include” file in the parent include file.
  • You can continue to chain subsections by adding them the same way but within the section folder and including it’s in the parent .
  • That way if the folder structure is changed, you only have to modify the line for the section in to update the base path, instead of having to modify each line in the to reflect the new folder structure.

A scalable boilerplate for AngularJS 1.x using requirejs
Continue reading “angular-scalable-boilerplate”

AngularJS Tutorial

Learn AngularJS #angular2 #angularjs #javascript #programming #love

Code day 6 — AngularJS – Rishi Raj – Medium

Code day 6 — AngularJS  #javascript

  • Programming is a task that can take a lot of time and it usually does not improve one’s communication skills, there was a time where my programming skills were getting significantly better day after day while my communication skills were not.
  • Never miss a story from Rishi Raj , when you sign up for Medium.
  • While there are countless blog articles about technology on Medium, the number of new articles on communication skills seems lacking I decided to also create blog articles on that topic, you can expect a blog article on communication tips soon on this blog.
  • The blog has significantly improved my communication skills and broaden my knowledge about various things such as business and technology.
  • Below is a screenshot of the app, the codes will be soon posted on my Github account, stay tuned.

This week, it was hard to leave home due to the stormy weather in Mauritius so I dived deep into the AngularJS world, after looking at various AngularJS playlists on YouTube, tried The net ninja…
Continue reading “Code day 6 — AngularJS – Rishi Raj – Medium”

AngularJS Tutorial

Learn AngularJS #angular2 #angularjs #javascript #programming #love

AngularJS Tutorial

Roy Sivan

  • I have been using WordPress since the early days.
  • Powering applications (native or not) was challenging, till the WordPress REST API was introduced.
  • Powering Content Driven Applications with the World’s Most Popular CMS
  • WordPress powers over 25% of the Internet, with its easy to use admin interface it is a great way to power the content of any site, or application.
  • I will walk through why and how to use the WordPress REST [

I have been using WordPress since the early days. Nowadays I’m a senior software developer that specializes in WordPress & front end tech at Disney. I was taught Angular 1 in an afternoon & fell in love, have been building WP + Angular apps since. I’m also socially awkward, but love when people say hi to me.
Continue reading “Roy Sivan”