これが複数の投稿で尋ねられ、回答されていることは理解していますが、解決策を試みましたが、まだそこに到達できません.
ui-router を使用してルーティングしているコンポーネントがいくつかあり、1 つは連絡フォームです。ユーザーがデータを入力して別のルートに移動すると、連絡フォームに戻り、状態がリロードされ、フォームの内容が消えます。
親状態と子状態を持つことでこれを行う別の方法を見ましたが、コードでこれを再現できませんでした。
スティッキー オプションでui-router-extrasを使用することで、より簡単な解決策があるかもしれませんが、私はこれを試みましたが、どちらも機能しませんでした。現在動作しているコードを掲載します。
(function () {
angular.module('personalPortfolio')
.config(['$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider) {
$stateProvider
.state('about', {
sticky: true,
url: '/about',
template: '<pg-about></pg-about>'
})
.state('development', {
sticky: true,
url: '/work',
template: '<pg-dev></pg-dev>'
})
.state('contact', {
sticky: true,
url: '/contact',
template: '<pg-contact></pg-contact>'
});
$urlRouterProvider.otherwise('/about');
}]);
})();