Search Posts

Category: angular-controller

calling an angular controller method via ng-click in es6

I’m testing using es6 with angular 1.6 using browserify and babelify in gulp and I’ve noticed that when I create a controller using es6 class I can no longer call the controller’s methods on the dom using ng-click. controller: export default class FocusbtnsController { constructor($scope) {} testMethod() { alert(‘test method works!!’); } } main module: import angular from ‘angular’; import FocusbtnsController from ‘./focusbtns.controller’; export default angular.module(‘shapesite’, []) .controller(‘FocusbtnsController’, FocusbtnsController); HTML: <div class=”center-btns ng-scope” ng-controller=”FocusbtnsController”> <div […]

Routing issue with angular directives

I’m trying to setup one of my first angular projects and am having trouble getting to grips with the routing. On page load I see the initial template that has been set by the preferencesDirective, which is great. When I click the “Change Template” button I want it to change to another template but nothing happens. If I set the template url’s in the $routeProvider to something invalid then I see a 404 error in […]