NG1 ES6 components usage
See original GitHub issueHi Hackers!
I was wondering, is there an example using a dynamic label from $scope => using ES6 Classes?
For example:
const testConfig = function($stateProvider) {
"ngInject";
$stateProvider
.state('testShow', {
url: '/{id:[0-9]+}',
component: 'testShow',
ncyBreadcrumb: {
parent: 'test',
label: 'Edit {{ $ctrl.name }}'
}
});
};
export default testConfig;
I am not able to use name, $ctrl.name nor $scope in the config route for this PoC.
import template from './index.html';
import controller from './controller';
import './styles.styl';
let testShowComponent = {
restrict: 'E',
bindings: {},
template,
controller,
controllerAs: '$ctrl'
};
export default testShowComponent;
import {Controller} from 'es6-angular-util';
class TestShowController extends Controller {
constructor($scope) {
"ngInject";
// required by es6-angular-util
super($scope);
this.name = 'TEST THIS';
$scope.name = 'TEST $SCOPE';
}
}
Any help is welcome, thanks!
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:10
Top Results From Across the Web
Preparing your Angular 1 codebase to upgrade to React or ...
First, we can remove the wrapping IIFE since Webpack will package each file in its own closure. We can also remove 'use strict'...
Read more >Guide: Route to Component - UI-Router
An AngularJS 1.5 component is a reusable piece of a web page, which encapsulates both structure (markup) and behavior. A component is self- ......
Read more >Writing Reusable Components in ES6 - Smashing Magazine
Used extensively in webpack, loaders can do things like transpile ES6 to ES5, Less to CSS, load JSON files, render templates and much...
Read more >Upgrading from AngularJS to Angular
In your Angular application, you need a component as a placeholder for your AngularJS content. This component uses the service you create to...
Read more >How To Use Es6 Syntax In React Functional Component
In this video I have shown how to use Es6 syntax for creating React Functional Component. Es6 syntax in React. React Es6 syntax....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

A possible solution is to use reslove in your route. If you do this you can access the $resolve of the ui-router
An other option is to use an inner property of angular called $$childHead (which retrieves a child scope)
@biltongza yep, thanks I already had this in my config too, usefeull for @tonestrike to know.