AngularJS implementation I'm trying to use AngularJS in Drupal 8 template.  My objective is to get the power of drupal as a backend to do content query, and AngularJS as a front end to make a single one page application. I'm implementing AngularJS in drupal module with name drupal_ng. The complete code is in https://github.com/agungsuyono/drupal_ng.  However, I'm wondering whether my implementation is not correct.  Because I didn't see the result as expected; it seemed ng-controller didn't work in the HTML template. The javascript controller that I wrote did not bind to the HTML template.

Here are some of the code of drupal_ng module. I really appreciate for any help.

drupal_ng/drupal_ng.module

    &lt;?php
    /**
     * Implements hook_theme().
     */
    function drupal_ng_theme() {
      return array(
        'drupal_ng_view' =&gt; array(
          'template' =&gt; 'view',
          'variables' =&gt; array('title' =&gt; NULL),
        ),
      );
    }


drupal_ng/drupal_ng.libraries.yml

    angularjs:
      version: VERSION
      js:
        'https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js':  {type: external}

    drupal_ng:
      js:
        js/drupal_ng.js: {}
      dependencies:
        - drupal_ng/angularjs


drupal_ng/src/Controller/DrupalNgController.php

    &lt;?php
    namespace Drupal\drupal_ng\Controller;

    use Drupal\Core\Controller\ControllerBase;

    class DrupalNgController extends ControllerBase {

      public function viewDrupalNg() {
        $title = t('Hello!');
        $build['myelement'] = array(
          '#theme' =&gt; 'drupal_ng_view',
          '#title' =&gt; $title,
        );
        $build['myelement']['#attached']['library'][] = 'drupal_ng/angularjs';
        $build['myelement']['#attached']['library'][] = 'drupal_ng/drupal_ng';
        return $build;
      }
    }


drupal_ng/js/drupal_ng.js

    var myApp = angular.module("myModule", []);

    myApp.controller("myController", function ($scope) {
      $scope.message = "This is AngularJS";
    });


The word "This is AngularJS" should appear in the HTML template below but it didn't.

drupal_ng/templates/view.html.twig

    &lt;h2&gt;{{  title }}&lt;/h2&gt;

    &lt;div ng-app="myModule"&gt; 
      &lt;div ng-controller="myController"&gt;
        {{ message }}
      &lt;/div&gt;
    &lt;/div&gt;


This is the screen shoot of the result in Chrome browser using AngularJS debugger.  From the debugger, it seems that the message "This is AngularJS" is already there, but it didn't appear in the screen.
I would like to just comment on this, because my answer is not exactly a solution to your particular implementation, but I do not have enough reputation :/

I will just say that in my opinion your approach to the problem is wrong. Because you are loading Angular as a JS library from Drupal, you are adding lots of unnecessary overhead to your application, especially to the initial load of the page and you are defeating the purpose of using a Front-end framework.

In my experience, using a Front-end framework like Angular is a solution to completely decouple the Front-end from the Back-end. So my suggestions is just that:

Create a regular Angular application and inside that Angular app you create a sub-folder that will contain your Drupal application.

And from this point on you can use REST webservices for fetching the data from Drupal. The core Views module combined with the core REST module provides out of the box Drupal functionality for this, and in addition Symfony provides the JsonResponse class that you use for sending simple responses. ( I really recommend using the JsonResponse, because it just bypasses Drupal's entire rendering system)

This way, you have nice Back-end code that can be organized in different controllers, which will callbacks to routes exposed as REST endpoints and a completely decoupled Front-end layer that will only call a number of select REST methods on different routes.

PS: for more information on this topic, please search for the term Headless Drupal, and you will find lots of helpful info