using Angular JS 1.5.8 ; I have multiple controllers where we have created different methods and now when I look into 2 controllers , they have almost same methods. So mu question is how can we apply inheritance kind of thing so that both controller can get same methods from that one place.
controller A
angular.extend(vm, {
cancel: cancel,
change: change,
checkTable: checkTable,
edit: edit,
enable: enable,
enroll: enroll,
listTables: listTables,
reload: reload,
save: save,
show: show,
view: view
});
controller B
angular.extend(vm, {
cancel: cancel,
change: change,
checkColumn: checkColumn,
edit: edit,
enable: enable,
enroll: enroll,
listColumns: listColumns,
reload: reload,
save: save,
show: show,
view: view
});
As you can see both controller have multiple similar methods.
I know that we can create service but these methods already using service within.
can you suggest any good approach.